【7.6.0】【sys】【org】更新组织机构的查询排序和查询条件拼接问题

pull/57/head
fengshuonan 2023-06-29 11:55:16 +08:00
parent e64eb25532
commit cbfe1267e3
1 changed files with 12 additions and 7 deletions

View File

@ -215,7 +215,10 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
// 去重 // 去重
List<HrOrganization> newNotRepeatList = hrOrganizationList.stream().collect( List<HrOrganization> newNotRepeatList = hrOrganizationList.stream().collect(
Collectors.collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(HrOrganization::getOrgId))), Collectors.collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(HrOrganization::getOrgId))),
ArrayList::new)); LinkedList::new));
// 从新排序根据sort字段排序
newNotRepeatList.sort(Comparator.comparing(HrOrganization::getOrgSort));
// 构建树形结构 // 构建树形结构
return new DefaultTreeBuildFactory<HrOrganization>().doTreeBuild(newNotRepeatList); return new DefaultTreeBuildFactory<HrOrganization>().doTreeBuild(newNotRepeatList);
@ -367,11 +370,13 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
// 如果按文本查询条件不为空,则判断组织机构名称、简称、税号、备注是否有匹配 // 如果按文本查询条件不为空,则判断组织机构名称、简称、税号、备注是否有匹配
String searchText = hrOrganizationRequest.getSearchText(); String searchText = hrOrganizationRequest.getSearchText();
if (StrUtil.isNotEmpty(searchText)) { if (StrUtil.isNotEmpty(searchText)) {
queryWrapper.like(HrOrganization::getOrgName, searchText); queryWrapper.nested(wrap -> {
queryWrapper.or().like(HrOrganization::getOrgShortName, searchText); wrap.like(HrOrganization::getOrgName, searchText);
queryWrapper.or().like(HrOrganization::getTaxNo, searchText); wrap.or().like(HrOrganization::getOrgShortName, searchText);
queryWrapper.or().like(HrOrganization::getOrgCode, searchText); wrap.or().like(HrOrganization::getTaxNo, searchText);
queryWrapper.or().like(HrOrganization::getRemark, searchText); wrap.or().like(HrOrganization::getOrgCode, searchText);
wrap.or().like(HrOrganization::getRemark, searchText);
});
} }
// 根据机构状态查询 // 根据机构状态查询
@ -383,7 +388,7 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
if (orgId != null) { if (orgId != null) {
// 查询orgId对应的所有子机构包含本orgId // 查询orgId对应的所有子机构包含本orgId
List<Long> subOrgIdListOneLevel = this.getSubOrgIdListOneLevel(orgId); List<Long> subOrgIdListOneLevel = this.getSubOrgIdListOneLevel(orgId);
queryWrapper.nested(i -> i.in(HrOrganization::getOrgId, subOrgIdListOneLevel)); queryWrapper.in(HrOrganization::getOrgId, subOrgIdListOneLevel);
} }
// 根据排序正序查询 // 根据排序正序查询