| | |
| | | package com.mindskip.xzs.controller.admin; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.mindskip.xzs.base.BaseApiController; |
| | | import com.mindskip.xzs.base.RestResponse; |
| | | import com.mindskip.xzs.domain.Department; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/add", method = RequestMethod.POST) |
| | | public RestResponse add(@RequestBody @Valid String name) { |
| | | return RestResponse.ok(departmentService.add(name)); |
| | | public RestResponse add(@RequestBody @Valid Department model) { |
| | | return RestResponse.ok(departmentService.add(model)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/update", method = RequestMethod.POST) |
| | |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.POST) |
| | | public RestResponse update(@PathVariable Integer id) { |
| | | return RestResponse.ok(departmentService.getById(id)); |
| | | return RestResponse.ok(departmentService.getByIdVO(id)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getUserByDepartment/{id}", method = RequestMethod.POST) |
| | |
| | | |
| | | @RequestMapping(value = "/getDeptAdmins", method = RequestMethod.GET) |
| | | public RestResponse<List<Department>> getDeptAdmins(){ |
| | | return RestResponse.ok(userService.getDeptAdmins(isDeptAdmin() ? getCurrentUser().getId() : null)); |
| | | return RestResponse.ok(userService.getDeptAdmins(isDeptAdmin() ? getAdminDeptIds() : null)); |
| | | } |
| | | |
| | | @GetMapping("/cascader") |
| | |
| | | return RestResponse.ok(departmentService.cascader()); |
| | | } |
| | | |
| | | @GetMapping("/getCurrentDeptId") |
| | | public RestResponse<List<Integer>> getCurrentDeptIds(){ |
| | | return RestResponse.ok(getAdminDeptIds()); |
| | | } |
| | | |
| | | } |