代码提交部门新增根据code查询下级所有 pms台账
This commit is contained in:
@@ -392,13 +392,13 @@ public class DeptController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* @Description: "获取当前部门的的下级子部门list,如果没子部门就是返回当前部门
|
||||
* @Param: [deptId]
|
||||
* @Param: [deptId]
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<java.util.List<com.njcn.user.pojo.dto.DeptDTO>>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDepSonDetailIdByDeptId")
|
||||
@ApiOperation("获取当前部门的的下级子部门list,如果没子部门就是返回当前部门")
|
||||
@@ -409,6 +409,28 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部code获取所有子部门以及自身的code
|
||||
* @author cdf
|
||||
* @date 2023/2/21
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDepSonSelfCodetByCode")
|
||||
@ApiOperation("根据部门code获取所有子部门以及自身的code")
|
||||
public HttpResult<List<String>> getDepSonSelfCodetByCode(@RequestParam("code")String code) {
|
||||
String methodDescribe = getMethodDescribe("getDepSonSelfCodetByCode");
|
||||
List<String> deptList = deptService.getDepSonSelfCodetByCode(code);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++begin*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++end*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -170,6 +170,14 @@ public interface IDeptService extends IService<Dept> {
|
||||
*/
|
||||
List<String> getDepSonSelfCodetByDeptId(String id);
|
||||
|
||||
/**
|
||||
* 根据部code获取所有子部门以及自身的code
|
||||
* @author cdf
|
||||
* @date 2022/7/13
|
||||
*/
|
||||
List<String> getDepSonSelfCodetByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
* @author dhj
|
||||
@@ -198,12 +206,12 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @date 2023/1/6
|
||||
*/
|
||||
Dept getRootDept();
|
||||
/**
|
||||
/**
|
||||
* @Description: 获取当前部门的的下级子部门list,如果没子部门就是返回当前部门
|
||||
* @Param: [deptId]
|
||||
* @return: java.util.List<com.njcn.user.pojo.dto.DeptDTO>
|
||||
* @Param: [deptId]
|
||||
* @return: java.util.List<com.njcn.user.pojo.dto.DeptDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
List<DeptDTO> getDepSonDetailByDeptId(String deptId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.user.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -40,6 +41,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -342,6 +344,21 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
return sonIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDepSonSelfCodetByCode(String code) {
|
||||
List<String> codes = new ArrayList<>();
|
||||
Dept dept = this.getDeptByCode(code);
|
||||
if(Objects.isNull(dept)){
|
||||
throw new BusinessException(UserResponseEnum.DEPT_MISSING);
|
||||
}
|
||||
List<DeptDTO> deptList = this.baseMapper.getDeptDescendantIndexes(dept.getId(), Stream.of(0,1).collect(Collectors.toList()));
|
||||
if(CollectionUtil.isNotEmpty(deptList)){
|
||||
codes = deptList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
codes.add(dept.getCode());
|
||||
}
|
||||
return codes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDepSonIdByDeptId(String id) {
|
||||
List<String> sonId = this.baseMapper.getDeptSonId(id);
|
||||
|
||||
Reference in New Issue
Block a user