新增查询挡墙部门直属下级部门(没有下级部门返回当前部门)接口
This commit is contained in:
@@ -392,6 +392,21 @@ public class DeptController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @Description: "获取当前部门的的下级子部门list,如果没子部门就是返回当前部门
|
||||
* @Param: [deptId]
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<java.util.List<com.njcn.user.pojo.dto.DeptDTO>>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDepSonDetailIdByDeptId")
|
||||
@ApiOperation("获取当前部门的的下级子部门list,如果没子部门就是返回当前部门")
|
||||
public HttpResult<List<DeptDTO>> getDepSonDetailByDeptId(@RequestParam("deptId")String deptId) {
|
||||
String methodDescribe = getMethodDescribe("getDepSonDetailByDeptId");
|
||||
List<DeptDTO> deptList = deptService.getDepSonDetailByDeptId(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.param.DeptParam;
|
||||
@@ -11,7 +10,6 @@ import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -200,4 +198,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>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
List<DeptDTO> getDepSonDetailByDeptId(String deptId);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
@@ -27,13 +27,14 @@ import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.user.service.IDeptService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -371,4 +372,34 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
lambdaQueryWrapper.eq(Dept::getState,DataStateEnum.ENABLE.getCode()).eq(Dept::getPid,0);
|
||||
return this.getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deptId
|
||||
* @Description: "获取当前部门的的下级子部门list,如果没子部门就是返回当前部门
|
||||
* @Param: [deptId]
|
||||
* @return: java.util.List<com.njcn.user.pojo.po.Dept>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
@Override
|
||||
public List<DeptDTO> getDepSonDetailByDeptId(String deptId) {
|
||||
List<Dept> result = new ArrayList<> ();
|
||||
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq (Dept::getPid, deptId).
|
||||
eq (Dept::getState,DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList (lambdaQueryWrapper);
|
||||
if(CollectionUtils.isEmpty (result)){
|
||||
LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
deptLambdaQueryWrapper.eq (Dept::getId, deptId).
|
||||
eq (Dept::getState,DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList (deptLambdaQueryWrapper);
|
||||
}
|
||||
List<DeptDTO> collect = result.stream ( ).map (temp -> {
|
||||
DeptDTO deptDTO = new DeptDTO ( );
|
||||
BeanUtils.copyProperties (temp, deptDTO);
|
||||
return deptDTO;
|
||||
}).collect (Collectors.toList ( ));
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user