Initial commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.datao.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.datao.Result.AjaxResult;
|
||||
import com.datao.domain.Server;
|
||||
import com.datao.service.ServerService;
|
||||
import com.datao.util.page.BasePage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admin/server")
|
||||
public class ServerController {
|
||||
@Autowired
|
||||
ServerService serverService;
|
||||
|
||||
@PostMapping("/page")
|
||||
public AjaxResult pageList(@RequestBody BasePage dto){
|
||||
IPage<Server> swPage = serverService.page(new Page(dto.getPageNum(),dto.getPageSize())); // .pageList(dto);
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("data", swPage);
|
||||
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody Server dto){
|
||||
if( serverService.saveOrUpdate(dto)){// .update(dto) ) {
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
else {
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/{sid}")
|
||||
public AjaxResult delete(@PathVariable Integer sid){
|
||||
if(serverService.removeById(sid)){//.delete(sid)) {
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
else {
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user