添加部门接口

This commit is contained in:
2023-01-06 15:14:09 +08:00
parent f2851d2a97
commit d778e16165
7 changed files with 51 additions and 1138 deletions

View File

@@ -375,6 +375,25 @@ public class DeptController extends BaseController {
}
/**
* 获取最高级部门
* @author cdf
* @date 2023/1/6
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/getRootDept")
@ApiOperation("获取根部门")
public HttpResult<Dept> getRootDept(){
String methodDescribe = getMethodDescribe("getRootDept");
Dept dept = deptService.getRootDept();
if(Objects.nonNull(dept)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dept, methodDescribe);
}else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
}

View File

@@ -193,4 +193,11 @@ public interface IDeptService extends IService<Dept> {
* @date 2022/12/8
*/
List<Dept> getSpecialDeptList();
/**
* 获取根部门
* @author cdf
* @date 2023/1/6
*/
Dept getRootDept();
}

View File

@@ -364,4 +364,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
lambdaQueryWrapper.eq(Dept::getSpecialType,1).eq(Dept::getState, DataStateEnum.ENABLE.getCode());
return this.list(lambdaQueryWrapper);
}
@Override
public Dept getRootDept(){
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Dept::getState,DataStateEnum.ENABLE.getCode()).eq(Dept::getPid,0);
return this.getOne(lambdaQueryWrapper);
}
}