RoleController.java
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.tianbo.warehouse.controller;
import com.github.pagehelper.PageInfo;
import com.tianbo.warehouse.controller.response.ResultJson;
import com.tianbo.warehouse.model.ROLE;
import com.tianbo.warehouse.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController()
public class RoleController {
@Autowired
RoleService roleService;
@GetMapping("/role/list")
public PageInfo<ROLE> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
int pageNum,
@RequestParam(value = "pageSize",required = false,defaultValue = "5")
int pageSize){
return roleService.findAll(pageNum,pageSize);
}
@PostMapping("/role/add")
public ResultJson add(@RequestBody ROLE role){
int i =roleService.insertSelective(role);
ResultJson resultJson = new ResultJson();
if (1==i){
resultJson = new ResultJson("200","添加账户成功");
}else {
resultJson = new ResultJson("500","insert faild");
}
return resultJson;
}
}