|
@@ -2,6 +2,7 @@ package com.xiaoan.web.backend;
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.xiaoan.common.constant.MsgCode;
|
|
|
+import com.xiaoan.common.model.PageDto;
|
|
|
import com.xiaoan.common.util.ResultJson;
|
|
|
import com.xiaoan.domain.backend.DepartmentEntity;
|
|
|
import com.xiaoan.domain.dto.request.DepartmentRequest;
|
|
@@ -22,28 +23,34 @@ import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
/**
|
|
|
* Created by Hb_zzZ on 2020/2/27.
|
|
|
+ *
|
|
|
+ * 需要admin权限
|
|
|
*/
|
|
|
@Api(tags = "DepartmentController", description = "后台部门管理")
|
|
|
@RestController
|
|
|
@RequestMapping("api/manage/department")
|
|
|
@Transactional
|
|
|
-public class DepartmentController {
|
|
|
+public class DepartmentController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private DepartmentService departmentService;
|
|
|
|
|
|
- @ApiOperation("分页获取部门列表")
|
|
|
- @WebControllerLog(description = "分页获取部门列表")
|
|
|
+ @ApiOperation("分页获取部门列表/搜索")
|
|
|
+ @WebControllerLog(description = "部门信息-查询列表")
|
|
|
@PostMapping("list")
|
|
|
- public ResultJson list(@RequestBody DepartmentRequest param){
|
|
|
+ public ResultJson list(@RequestBody PageDto param){
|
|
|
+
|
|
|
+ String token = request.getHeader("Authorization");
|
|
|
+ System.out.println(token);
|
|
|
+
|
|
|
Condition condition = new Condition(DepartmentEntity.class);
|
|
|
- condition.and().andLike("name", "%" + param.getName() + "%");
|
|
|
+ condition.and().andLike("name", "%" + param.getSearchKey()+ "%");
|
|
|
PageInfo<DepartmentEntity> pageInfo = departmentService.findAll(condition, param.getPageNum(), param.getPageSize());
|
|
|
return new ResultJson(MsgCode.SUCCESS_CODE, pageInfo);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("新增部门")
|
|
|
- @WebControllerLog(description = "新增部门")
|
|
|
+ @WebControllerLog(description = "部门信息-新增部门")
|
|
|
@PostMapping("save")
|
|
|
public ResultJson save(@RequestBody DepartmentRequest param){
|
|
|
if(StringUtils.isEmpty(param.getName()) || StringUtils.isEmpty(param.getNum())){
|
|
@@ -61,7 +68,7 @@ public class DepartmentController {
|
|
|
return new ResultJson(MsgCode.SUCCESS_CODE, MsgCode.SUCCESS_MSG);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("删除部门")
|
|
|
+ @ApiOperation("部门信息-删除部门")
|
|
|
@PostMapping("delete")
|
|
|
public ResultJson delete(@RequestBody DepartmentRequest param){
|
|
|
if(param.getId() == null){
|