Commit 845c3d07 authored by 鲁鸿波's avatar 鲁鸿波

承包商人员台账查询优化

parent 14cb2666
......@@ -21,4 +21,7 @@ public interface TContractorLedgerDao extends SuperDao<TContractorLedger>
List<String> findContractorLedgerNames(@Param("param") TContractorLedgerParam param);
String orgIdDistinct(@Param("orgId")String orgId);
}
......@@ -414,11 +414,17 @@ public class TContractorPersonServiceImpl extends SuperServiceImpl<TContractorPe
// //将同一机构下的机构ID添加到集合中
// ids.addAll(orgIds);
// }
List<String> ids = newSysOrgService.getIdsChildrenById(orgId);
//List<String> ids = newSysOrgService.getIdsChildrenById(orgId);
List<String> ids = new ArrayList<>();
ids.addAll(Arrays.asList(contractorLedgerDao.orgIdDistinct(orgId).split(",")));
log.info("承包商人员台账列表--ids1------>ids值:{}",ids);
ids.addAll(newSysOrgService.getIdsChildrenById(orgId));
log.info("承包商人员台账列表--ids2------>ids值:{}",ids);
//查询同一机构创建的人员
queryWrapper.in(TContractorPerson.ORG_ID,ids);
if (ObjectHelper.isNotEmpty(queryParam.getIds())) {
if ("0".equals(queryParam.getTypeQuery())){
queryWrapper.notIn("id", queryParam.getIds());
......
......@@ -73,5 +73,14 @@
and t.status = '0'
</select>
<select id="orgIdDistinct" resultType="java.lang.String">
SELECT string_agg(DISTINCT org_id, ',') AS concatenated_org_ids
FROM (
SELECT unnest(string_to_array(org_id, ',')) AS org_id
FROM t_contractor_ledger
WHERE org_id like concat('%',#{orgId},'%')
) AS expanded_ids
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment