|  |  | package com.tianbo.warehouse.controller; | 
|  |  |  | 
|  |  | import com.github.pagehelper.PageInfo; | 
|  |  | import com.tianbo.warehouse.controller.response.ResultJson; | 
|  |  | import com.tianbo.warehouse.model.DataPermission; | 
|  |  | import com.tianbo.warehouse.service.DataPermissionService; | 
|  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|  |  | import org.springframework.web.bind.annotation.*; | 
|  |  |  | 
|  |  | @RestController | 
|  |  | @RequestMapping("/dataPermission") | 
|  |  | public class DataPermissionController { | 
|  |  |  | 
|  |  | @Autowired | 
|  |  | private DataPermissionService dataPermissionService; | 
|  |  |  | 
|  |  | @GetMapping("/{data_perm_id}") | 
|  |  | public ResultJson<DataPermission> getDataPermission(@PathVariable("data_perm_id") Integer dataPermId) { | 
|  |  | DataPermission dataPermission = dataPermissionService.selectByPrimaryKey(dataPermId); | 
|  |  | return new ResultJson("200","查询数据权限成功",dataPermission); | 
|  |  | } | 
|  |  |  | 
|  |  | @PostMapping("/create") | 
|  |  | public ResultJson<Integer> createDataPermission(@RequestBody DataPermission dataPermission) { | 
|  |  | int i=  dataPermissionService.insertSelective(dataPermission); | 
|  |  | return i==1 ? new ResultJson("200","新增数据权限成功") :new ResultJson("500","新增数据权限失败"); | 
|  |  | } | 
|  |  |  | 
|  |  | @PostMapping("/update") | 
|  |  | public ResultJson<Integer> updateDataPermission(@RequestBody DataPermission dataPermission) { | 
|  |  | int i = dataPermissionService.updateByPrimaryKeySelective(dataPermission); | 
|  |  | return i==1 ? new ResultJson("200","更新数据权限成功") :new ResultJson("500","更新数据权限失败"); | 
|  |  | } | 
|  |  |  | 
|  |  | @PostMapping("/del/{data_perm_id}") | 
|  |  | public ResultJson<Integer> deleteDataPermission(@PathVariable("data_perm_id") Integer dataPermId) { | 
|  |  | int i =  dataPermissionService.deleteByPrimaryKey(dataPermId); | 
|  |  | return i==1 ? new ResultJson("200","删除数据权限成功") :new ResultJson("500","删除数据权限失败"); | 
|  |  | } | 
|  |  |  | 
|  |  | @GetMapping("/list") | 
|  |  | public ResultJson<PageInfo> getAllDataPermissions(@RequestParam(defaultValue = "1") int pageNum, | 
|  |  | @RequestParam(defaultValue = "10") int pageSize) { | 
|  |  | PageInfo<DataPermission> dataPermissionPageInfo = dataPermissionService.selectAll(pageNum, pageSize); | 
|  |  | return new ResultJson<PageInfo>("200","获取数据权限成功",dataPermissionPageInfo); | 
|  |  | } | 
|  |  | } | 
... | ... |  |