添加部门接口
This commit is contained in:
@@ -97,4 +97,10 @@ public interface DeptFeignClient {
|
||||
*/
|
||||
@GetMapping("/getSpecialDeptList")
|
||||
HttpResult<List<Dept>> getSpecialDeptList();
|
||||
|
||||
/**
|
||||
* 获取根部门
|
||||
*/
|
||||
@GetMapping("/getRootDept")
|
||||
HttpResult<Dept> getRootDept();
|
||||
}
|
||||
|
||||
@@ -105,6 +105,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有本部异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Dept> getRootDept() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询根部门异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user