部门增加所有企业的树状结构
parent
c81d15084c
commit
a6131058b2
|
|
@ -85,11 +85,16 @@ public class DepartmentController {
|
||||||
departmentService.edit(departmentUpdateCmd);
|
departmentService.edit(departmentUpdateCmd);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
@ApiOperation("部门树状所有数据")
|
@ApiOperation("企业下部门树状所有数据")
|
||||||
@PostMapping("/listTree")
|
@PostMapping("/listTree")
|
||||||
public MultiResponse<DepartmentTreeInfoCO> listTree(@Validated @RequestBody DepartmentTreeQry qry) {
|
public MultiResponse<DepartmentTreeInfoCO> listTree(@Validated @RequestBody DepartmentTreeQry qry) {
|
||||||
return MultiResponse.of(departmentService.listTree(qry));
|
return MultiResponse.of(departmentService.listTree(qry));
|
||||||
}
|
}
|
||||||
|
@ApiOperation("所有企业下部门树状所有数据")
|
||||||
|
@PostMapping("/listAllTree")
|
||||||
|
public MultiResponse<List<DepartmentTreeInfoCO>> listAllTree() {
|
||||||
|
return MultiResponse.of(departmentService.listAllTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,5 +127,25 @@ public class DepartmentQueryExe {
|
||||||
List<DepartmentDO> list = departmentRepository.list();
|
List<DepartmentDO> list = departmentRepository.list();
|
||||||
return departmentCoConvertor.converDOsToCOs(list);
|
return departmentCoConvertor.converDOsToCOs(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<List<DepartmentTreeInfoCO>> listAllTree() {
|
||||||
|
|
||||||
|
List<DepartmentDO> pageResponse = departmentRepository.listAllTree();
|
||||||
|
if (CollUtil.isEmpty(pageResponse)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<DepartmentTreeInfoCO> examCenterCOS = departmentCoConvertor.converDOsToInfoCOs(pageResponse);
|
||||||
|
//GBS部门根节点父部门是tenantId
|
||||||
|
//按照企业分组
|
||||||
|
List<List<DepartmentTreeInfoCO>> result1= new ArrayList<>();
|
||||||
|
Map<Long, List<DepartmentTreeInfoCO>> corpMap = examCenterCOS.stream().collect(Collectors.groupingBy(DepartmentTreeInfoCO::getCorpinfoId));
|
||||||
|
corpMap.forEach((corpId, list) -> {
|
||||||
|
List<DepartmentTreeInfoCO> departmentTreeInfoCOS = Tools.buildEntityTree(list, "id", "parentId", "childrenList", corpId);
|
||||||
|
result1.add(departmentTreeInfoCOS);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return result1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,5 +82,9 @@ public class DepartmentServiceImpl implements DepartmentServiceI {
|
||||||
return departmentQueryExe.getDeptList();
|
return departmentQueryExe.getDeptList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<List<DepartmentTreeInfoCO>> listAllTree() {
|
||||||
|
return departmentQueryExe.listAllTree();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,7 @@ public interface DepartmentServiceI {
|
||||||
List<DepartmentCO> listByDepartIds(Collection<Long> collection);
|
List<DepartmentCO> listByDepartIds(Collection<Long> collection);
|
||||||
|
|
||||||
List<DepartmentCO> getDeptList();
|
List<DepartmentCO> getDeptList();
|
||||||
|
|
||||||
|
Collection<List<DepartmentTreeInfoCO>> listAllTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ public class DepartmentTreeInfoCO extends ClientObject {
|
||||||
//主键
|
//主键
|
||||||
@ApiModelProperty(value = "主键")
|
@ApiModelProperty(value = "主键")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@ApiModelProperty(value = "所属企业")
|
||||||
|
private Long corpinfoId;
|
||||||
//部门id
|
//部门id
|
||||||
@ApiModelProperty(value = "部门id")
|
@ApiModelProperty(value = "部门id")
|
||||||
private String departmentId;
|
private String departmentId;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.zcloud.basic.info.persistence.mapper;
|
package com.zcloud.basic.info.persistence.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.jjb.saas.framework.datascope.annotation.DataScope;
|
|
||||||
import com.jjb.saas.framework.datascope.annotation.DataScopes;
|
|
||||||
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-infrastructure
|
* web-infrastructure
|
||||||
*
|
*
|
||||||
|
|
@ -15,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DepartmentMapper extends BaseMapper<DepartmentDO> {
|
public interface DepartmentMapper extends BaseMapper<DepartmentDO> {
|
||||||
|
|
||||||
|
List<DepartmentDO> listAllTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,6 @@ public interface DepartmentRepository extends BaseRepository<DepartmentDO> {
|
||||||
void updateInfoById(DepartmentDO departmentDO);
|
void updateInfoById(DepartmentDO departmentDO);
|
||||||
|
|
||||||
|
|
||||||
|
List<DepartmentDO> listAllTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,5 +119,9 @@ public class DepartmentRepositoryImpl extends BaseRepositoryImpl<DepartmentMappe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentDO> listAllTree() {
|
||||||
|
return departmentMapper.listAllTree();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,9 @@
|
||||||
|
|
||||||
<mapper namespace="com.zcloud.basic.info.persistence.mapper.DepartmentMapper">
|
<mapper namespace="com.zcloud.basic.info.persistence.mapper.DepartmentMapper">
|
||||||
|
|
||||||
|
<select id="listAllTree" resultType="com.zcloud.basic.info.persistence.dataobject.DepartmentDO">
|
||||||
|
select * from department where delete_enum = 'FALSE'
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue