添加获取公司节点信息接口
This commit is contained in:
@@ -107,6 +107,12 @@ public class DeptApiImpl implements DeptApi {
|
||||
return success(BeanUtils.toBean(companyDeptInfos, CompanyDeptInfoRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<DeptRespDTO>> upFindCompanyNode(Long deptId) {
|
||||
List<DeptDO> depts = deptService.upFindCompanyNode(deptId);
|
||||
return success(BeanUtils.toBean(depts, DeptRespDTO.class));
|
||||
}
|
||||
|
||||
// ========== 数据同步专用接口 ==========
|
||||
|
||||
@Override
|
||||
|
||||
@@ -165,4 +165,11 @@ public class DeptController {
|
||||
return success(BeanUtils.toBean(companyDeptInfos, CompanyDeptInfoRespDTO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/up-find-company-node")
|
||||
@Operation(summary = "获取公司节点信息", description = "通过部门编号,向上追溯部门信息,直到上级部门是公司,返回追溯到的部门信息列表")
|
||||
@Parameter(name = "deptId", description = "部门编号", required = true, example = "1024")
|
||||
public CommonResult<List<DeptRespVO>> upFindCompanyNode(@RequestParam("deptId") Long deptId) {
|
||||
List<DeptDO> list = deptService.upFindCompanyNode(deptId);
|
||||
return success(BeanUtils.toBean(list, DeptRespVO.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||
import com.zt.plat.module.system.dal.dataobject.dept.DeptDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -167,4 +169,9 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
||||
);
|
||||
}
|
||||
|
||||
@Select("""
|
||||
SELECT sd.* FROM SYSTEM_DEPT sd START WITH sd.id = #{deptId}
|
||||
CONNECT BY PRIOR sd.parent_id = sd.id AND PRIOR sd.is_company <> 1 ;
|
||||
""")
|
||||
List<DeptDO> upFindCompanyNode(@Param("deptId") Long deptId);
|
||||
}
|
||||
|
||||
@@ -185,4 +185,11 @@ public interface DeptService {
|
||||
// ========== 数据同步专用接口 ==========
|
||||
|
||||
void syncDept(DeptSaveReqVO syncReqVO);
|
||||
|
||||
/**
|
||||
* 向上查找公司节点信息
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
List<DeptDO> upFindCompanyNode(Long deptId);
|
||||
}
|
||||
|
||||
@@ -960,4 +960,9 @@ public class DeptServiceImpl implements DeptService {
|
||||
// 注意:不发布变更事件,避免循环同步
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> upFindCompanyNode(Long deptId) {
|
||||
return deptMapper.upFindCompanyNode(deptId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user