查询所有企业部门树,添加企业类型条件
parent
6660aaa493
commit
08fd4da6eb
|
|
@ -87,8 +87,8 @@ public class DepartmentController {
|
|||
}
|
||||
@ApiOperation("所有企业下部门树状所有数据")
|
||||
@PostMapping("/listAllTree")
|
||||
public MultiResponse<DepartmentTreeInfoCO> listAllTree() {
|
||||
return MultiResponse.of(departmentService.listAllTree());
|
||||
public MultiResponse<DepartmentTreeInfoCO> listAllTree( @RequestBody DepartmentTreeQry qry) {
|
||||
return MultiResponse.of(departmentService.listAllTree(qry));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -151,14 +151,15 @@ public class DepartmentQueryExe {
|
|||
return departmentCoConvertor.converDOsToCOs(list);
|
||||
}
|
||||
|
||||
public List<DepartmentTreeInfoCO> listAllTree() {
|
||||
public List<DepartmentTreeInfoCO> listAllTree(DepartmentTreeQry departmentQry) {
|
||||
Map<String, Object> parmas = PageQueryHelper.toHashMap(departmentQry);
|
||||
|
||||
List<DepartmentDO> pageResponse = departmentRepository.listAllTree();
|
||||
List<DepartmentDO> pageResponse = departmentRepository.listAllTree(parmas);
|
||||
if (CollUtil.isEmpty(pageResponse)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<DepartmentTreeInfoCO> examCenterCOS = departmentCoConvertor.converDOsToInfoCOs(pageResponse);
|
||||
Map<Long, String> corpinfoMap = corpInfoRepository.getCorpinfoNameByCorpinfoId(examCenterCOS.stream().map(DepartmentTreeInfoCO::getCorpinfoId).collect(Collectors.toList()));
|
||||
Map<Long, String> corpinfoMap = corpInfoRepository.getCorpinfoNameByCorpinfoId(examCenterCOS.stream().map(DepartmentTreeInfoCO::getCorpinfoId).distinct().collect(Collectors.toList()));
|
||||
if (CollUtil.isNotEmpty(corpinfoMap)) {
|
||||
List<Long> departmentIds = examCenterCOS.stream().peek(examCenterCO -> {
|
||||
examCenterCO.setCorpinfoName(corpinfoMap.getOrDefault(examCenterCO.getCorpinfoId(), StringUtils.EMPTY));
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ public class DepartmentServiceImpl implements DepartmentServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentTreeInfoCO> listAllTree() {
|
||||
return departmentQueryExe.listAllTree();
|
||||
public List<DepartmentTreeInfoCO> listAllTree(DepartmentTreeQry qry) {
|
||||
return departmentQueryExe.listAllTree(qry);
|
||||
}
|
||||
@Override
|
||||
@Cacheable(value = "deptAllNameCache", key="'deptId:'+#deptId")
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public interface DepartmentServiceI {
|
|||
|
||||
List<DepartmentCO> getDeptList();
|
||||
|
||||
List<DepartmentTreeInfoCO> listAllTree();
|
||||
List<DepartmentTreeInfoCO> listAllTree(DepartmentTreeQry qry);
|
||||
|
||||
String getFullNameForList(Long deptId, List<DepartmentCO> list);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.alibaba.cola.dto.PageQuery;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-client
|
||||
|
|
@ -29,6 +31,8 @@ public class DepartmentTreeQry {
|
|||
private Long eqCorpinfoId;
|
||||
@ApiModelProperty(value = "父id", name = "eqParentId")
|
||||
private Long eqParentId;
|
||||
@ApiModelProperty(value = "企业类型列表", name = "corpinfoTypeList")
|
||||
private List<Integer> corpinfoTypeList;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
|
|
@ -24,7 +25,7 @@ import java.util.List;
|
|||
})
|
||||
public interface DepartmentMapper extends BaseMapper<DepartmentDO> {
|
||||
|
||||
List<DepartmentDO> listAllTree();
|
||||
List<DepartmentDO> listAllTree(Map<String, Object> parmas);
|
||||
IPage<DepartmentDO> selectDeptPage(IPage<DepartmentDO> iPage, @Param("ew") QueryWrapper<DepartmentDO> queryWrapper, String menuPerms);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public interface DepartmentRepository extends BaseRepository<DepartmentDO> {
|
|||
void updateInfoById(DepartmentDO departmentDO);
|
||||
|
||||
|
||||
List<DepartmentDO> listAllTree();
|
||||
List<DepartmentDO> listAllTree(Map<String, Object> parmas);
|
||||
|
||||
boolean existsByName(@NotEmpty(message = "名称不能为空") String name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ public class DepartmentRepositoryImpl extends BaseRepositoryImpl<DepartmentMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentDO> listAllTree() {
|
||||
return departmentMapper.listAllTree();
|
||||
public List<DepartmentDO> listAllTree(Map<String, Object> parmas) {
|
||||
return departmentMapper.listAllTree(parmas);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,7 +5,18 @@
|
|||
<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' order by dep_order, create_time desc
|
||||
select d.*
|
||||
from department d
|
||||
left join corp_info c on d.corpinfo_id = c.id
|
||||
where d.delete_enum = 'FALSE'
|
||||
and c.delete_enum = 'FALSE'
|
||||
<if test="corpinfoTypeList != null and corpinfoTypeList.size() > 0">
|
||||
and c.type in
|
||||
<foreach collection="corpinfoTypeList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
order by d.dep_order, d.create_time desc
|
||||
</select>
|
||||
<select id="selectDeptPage" resultType="com.zcloud.basic.info.persistence.dataobject.DepartmentDO">
|
||||
SELECT *
|
||||
|
|
|
|||
Loading…
Reference in New Issue