feat: 标准列表搜索条件支持关联表查询 新增分标委 体系
This commit is contained in:
+62
-40
@@ -1867,99 +1867,121 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
// 拼接多表关联查询条件
|
// 拼接多表关联查询条件
|
||||||
Set<String> idSet = new HashSet<>();
|
Set<String> idSet = new HashSet<>();
|
||||||
Set<String> standNoSet = new HashSet<>();
|
Set<String> standNoSet = new HashSet<>();
|
||||||
|
boolean idSearch = false;
|
||||||
|
boolean standNoSearch = false;
|
||||||
// 企标独有权限
|
// 企标独有权限
|
||||||
if (module.equals(TableNameEnum.ENTERPRISE_STANDARDS.getValue())) {
|
if (module.equals(TableNameEnum.ENTERPRISE_STANDARDS.getValue())) {
|
||||||
// 授权部门
|
// 授权部门
|
||||||
String authDept = (String) parameterMap.get(FieldCommon.AUTH_DEPT);
|
String authDept = (String) parameterMap.get(FieldCommon.AUTH_DEPT);
|
||||||
if (StrUtil.isNotBlank(authDept)) {
|
if (StrUtil.isNotBlank(authDept)) {
|
||||||
|
idSearch = true;
|
||||||
LambdaQueryWrapper<EnterpriseStandardAuthDept> authDeptWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<EnterpriseStandardAuthDept> authDeptWrapper = new LambdaQueryWrapper<>();
|
||||||
List<String> authDeptIdList = Arrays.asList(authDept.split(","));
|
List<String> authDeptIdList = Arrays.asList(authDept.split(","));
|
||||||
authDeptWrapper.in(EnterpriseStandardAuthDept::getAuthDept, authDeptIdList);
|
authDeptWrapper.in(EnterpriseStandardAuthDept::getAuthDept, authDeptIdList);
|
||||||
List<EnterpriseStandardAuthDept> authList = enterpriseAuthDeptService.list(authDeptWrapper);
|
List<EnterpriseStandardAuthDept> authList = enterpriseAuthDeptService.list(authDeptWrapper);
|
||||||
String sql = authList.stream()
|
idSet.addAll(authList.stream().map(EnterpriseStandardAuthDept::getStandardId).collect(Collectors.toSet()));
|
||||||
.map(item -> "'" + item.getStandardId() + "'")
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
// 拼接SQL
|
|
||||||
selectCondition.append(" AND id IN (");
|
|
||||||
if (StrUtil.isBlank(sql)) {
|
|
||||||
sql = "''";
|
|
||||||
}
|
|
||||||
selectCondition.append(sql).append(")");
|
|
||||||
parameterMap.remove(FieldCommon.AUTH_DEPT);
|
parameterMap.remove(FieldCommon.AUTH_DEPT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 体系
|
||||||
|
String standardSystem = (String) parameterMap.get(FieldCommon.STANDARD_SYSTEM);
|
||||||
|
if (StrUtil.isNotBlank(standardSystem)) {
|
||||||
|
idSearch = true;
|
||||||
|
LambdaQueryWrapper<LawsNodeRelation> standSystemWrapper = new LambdaQueryWrapper<>();
|
||||||
|
List<String> standSystemIdList = Arrays.asList(standardSystem.split(","));
|
||||||
|
standSystemWrapper.in(LawsNodeRelation::getNodeId, standSystemIdList);
|
||||||
|
List<LawsNodeRelation> systemList = lawsNodeRelationService.list(standSystemWrapper);
|
||||||
|
idSet.addAll(systemList.stream().map(LawsNodeRelation::getUniqueRelationFlag).collect(Collectors.toSet()));
|
||||||
|
parameterMap.remove(FieldCommon.STANDARD_SYSTEM);
|
||||||
|
}
|
||||||
// 代替标准号
|
// 代替标准号
|
||||||
String replaceStandard = (String) parameterMap.get(FieldCommon.REPLACED_STANDARD);
|
String replaceStandard = (String) parameterMap.get(FieldCommon.REPLACED_STANDARD);
|
||||||
LambdaQueryWrapper<LawsReplacedStandard> replaceWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LawsReplacedStandard> replaceWrapper = new LambdaQueryWrapper<>();
|
||||||
if (StrUtil.isNotBlank(replaceStandard)) {
|
if (StrUtil.isNotBlank(replaceStandard)) {
|
||||||
|
standNoSearch = true;
|
||||||
List<String> standardNo = Arrays.asList(replaceStandard.split(","));
|
List<String> standardNo = Arrays.asList(replaceStandard.split(","));
|
||||||
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplaced, s));
|
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplaced, s));
|
||||||
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 1));
|
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 1));
|
||||||
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
||||||
String sql = replaceList.stream()
|
standNoSet.addAll(replaceList.stream().map(LawsReplacedStandard::getReplacedBy).collect(Collectors.toSet()));
|
||||||
.map(item -> "'" + item.getReplacedBy() + "'")
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
// 拼接SQL
|
|
||||||
selectCondition.append(" AND standard_number IN (");
|
|
||||||
if (StrUtil.isBlank(sql)) {
|
|
||||||
sql = "''";
|
|
||||||
}
|
|
||||||
selectCondition.append(sql).append(")");
|
|
||||||
parameterMap.remove(FieldCommon.REPLACED_STANDARD);
|
parameterMap.remove(FieldCommon.REPLACED_STANDARD);
|
||||||
}
|
}
|
||||||
// 被代替标准号
|
// 被代替标准号
|
||||||
String replacedByStandard = (String) parameterMap.get(FieldCommon.REPLACED_BY_STANDARD);
|
String replacedByStandard = (String) parameterMap.get(FieldCommon.REPLACED_BY_STANDARD);
|
||||||
if (StrUtil.isNotBlank(replacedByStandard)) {
|
if (StrUtil.isNotBlank(replacedByStandard)) {
|
||||||
|
standNoSearch = true;
|
||||||
List<String> standardNo = Arrays.asList(replacedByStandard.split(","));
|
List<String> standardNo = Arrays.asList(replacedByStandard.split(","));
|
||||||
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplacedBy, s));
|
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplacedBy, s));
|
||||||
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 1));
|
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 1));
|
||||||
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
||||||
String sql = replaceList.stream()
|
standNoSet.addAll(replaceList.stream().map(LawsReplacedStandard::getReplaced).collect(Collectors.toSet()));
|
||||||
.map(item -> "'" + item.getReplaced() + "'")
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
// 拼接SQL
|
|
||||||
selectCondition.append(" AND standard_number IN (");
|
|
||||||
if (StrUtil.isBlank(sql)) {
|
|
||||||
sql = "''";
|
|
||||||
}
|
|
||||||
selectCondition.append(sql).append(")");
|
|
||||||
parameterMap.remove(FieldCommon.REPLACED_BY_STANDARD);
|
parameterMap.remove(FieldCommon.REPLACED_BY_STANDARD);
|
||||||
}
|
}
|
||||||
// 引用标准号
|
// 引用标准号
|
||||||
String referenceStandard = (String) parameterMap.get(FieldCommon.REFERENCE_STANDARD);
|
String referenceStandard = (String) parameterMap.get(FieldCommon.REFERENCE_STANDARD);
|
||||||
if (StrUtil.isNotBlank(referenceStandard)) {
|
if (StrUtil.isNotBlank(referenceStandard)) {
|
||||||
|
standNoSearch = true;
|
||||||
List<String> standardNo = Arrays.asList(referenceStandard.split(","));
|
List<String> standardNo = Arrays.asList(referenceStandard.split(","));
|
||||||
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplaced, s));
|
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplaced, s));
|
||||||
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 2));
|
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 2));
|
||||||
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
||||||
String sql = replaceList.stream()
|
standNoSet.addAll(replaceList.stream().map(LawsReplacedStandard::getReplacedBy).collect(Collectors.toSet()));
|
||||||
.map(item -> "'" + item.getReplacedBy() + "'")
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
// 拼接SQL
|
|
||||||
selectCondition.append(" AND standard_number IN (");
|
|
||||||
if (StrUtil.isBlank(sql)) {
|
|
||||||
sql = "''";
|
|
||||||
}
|
|
||||||
selectCondition.append(sql).append(")");
|
|
||||||
parameterMap.remove(FieldCommon.REFERENCE_STANDARD);
|
parameterMap.remove(FieldCommon.REFERENCE_STANDARD);
|
||||||
}
|
}
|
||||||
// 被引用标准号
|
// 被引用标准号
|
||||||
String referencedStandard = (String) parameterMap.get(FieldCommon.REFERENCED_STANDARD);
|
String referencedStandard = (String) parameterMap.get(FieldCommon.REFERENCED_STANDARD);
|
||||||
if (StrUtil.isNotBlank(referencedStandard)) {
|
if (StrUtil.isNotBlank(referencedStandard)) {
|
||||||
|
standNoSearch = true;
|
||||||
List<String> standardNo = Arrays.asList(referencedStandard.split(","));
|
List<String> standardNo = Arrays.asList(referencedStandard.split(","));
|
||||||
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplacedBy, s));
|
standardNo.forEach(s -> replaceWrapper.like(LawsReplacedStandard::getReplacedBy, s));
|
||||||
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 2));
|
standardNo.forEach(s -> replaceWrapper.eq(LawsReplacedStandard::getType, 2));
|
||||||
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
List<LawsReplacedStandard> replaceList = lawsReplacedStandardService.list(replaceWrapper);
|
||||||
String sql = replaceList.stream()
|
standNoSet.addAll(replaceList.stream().map(LawsReplacedStandard::getReplaced).collect(Collectors.toSet()));
|
||||||
.map(item -> "'" + item.getReplaced() + "'")
|
parameterMap.remove(FieldCommon.REFERENCED_STANDARD);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分标委
|
||||||
|
String biddingCommittee = (String) parameterMap.get(FieldCommon.BIDDING_COMMITTEE);
|
||||||
|
if (StrUtil.isNotBlank(biddingCommittee)) {
|
||||||
|
LambdaQueryWrapper<LawsStandardization> standardizationWrapper = new LambdaQueryWrapper<>();
|
||||||
|
standardizationWrapper.eq(LawsStandardization::getPid, "0");
|
||||||
|
List<String> biddingCommitteeList = Arrays.asList(biddingCommittee.split(","));
|
||||||
|
LawsStandardization rootNode = lawsStandardizationService.getOne(standardizationWrapper);
|
||||||
|
standardizationWrapper.clear();
|
||||||
|
standardizationWrapper.eq(LawsStandardization::getPid, rootNode.getId());
|
||||||
|
List<LawsStandardization> nodeList = lawsStandardizationService.list(standardizationWrapper);
|
||||||
|
String sql = nodeList.stream()
|
||||||
|
.map(item -> "'" + item.getId() + "'")
|
||||||
.collect(Collectors.joining(","));
|
.collect(Collectors.joining(","));
|
||||||
// 拼接SQL
|
// 拼接SQL
|
||||||
selectCondition.append(" AND standard_number IN (");
|
selectCondition.append(" AND bidding_committee IN (");
|
||||||
if (StrUtil.isBlank(sql)) {
|
if (StrUtil.isBlank(sql)) {
|
||||||
sql = "''";
|
sql = "''";
|
||||||
}
|
}
|
||||||
selectCondition.append(sql).append(")");
|
selectCondition.append(sql).append(")");
|
||||||
parameterMap.remove(FieldCommon.REFERENCED_STANDARD);
|
parameterMap.remove(FieldCommon.BIDDING_COMMITTEE);
|
||||||
|
}
|
||||||
|
if (idSearch) {
|
||||||
|
String idSql = idSet.stream()
|
||||||
|
.map(item -> "'" + item + "'")
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
// 拼接SQL
|
||||||
|
selectCondition.append(" AND id IN (");
|
||||||
|
if (StrUtil.isBlank(idSql)) {
|
||||||
|
idSql = "''";
|
||||||
|
}
|
||||||
|
selectCondition.append(idSql).append(")");
|
||||||
|
}
|
||||||
|
if (standNoSearch) {
|
||||||
|
String noSql = standNoSet.stream()
|
||||||
|
.map(item -> "'" + item + "'")
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
// 拼接SQL
|
||||||
|
selectCondition.append(" AND standard_number IN (");
|
||||||
|
if (StrUtil.isBlank(noSql)) {
|
||||||
|
noSql = "''";
|
||||||
|
}
|
||||||
|
selectCondition.append(noSql).append(")");
|
||||||
}
|
}
|
||||||
selectCondition.append(" AND del_flag = 0");
|
selectCondition.append(" AND del_flag = 0");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user