|
@ -555,13 +555,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
//最终关联的子表对应的sql:
|
|
|
//最终关联的子表对应的sql:
|
|
|
List<String> finalSubTables =new ArrayList<>(); |
|
|
List<String> finalSubTables =new ArrayList<>(); |
|
|
|
|
|
//groupBy用到的表
|
|
|
|
|
|
Set<String> groupByTables=new HashSet<>(); |
|
|
subTables.forEach(subTable->{ |
|
|
subTables.forEach(subTable->{ |
|
|
if(tables.contains(subTable.getTableName())){ |
|
|
if(tables.contains(subTable.getTableName())){ |
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
|
|
|
if(subTable.getSupportAdd()){ |
|
|
|
|
|
groupByTables.add(subTable.getTableName()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>(); |
|
|
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>(); |
|
|
if (null == formDTO.getIsPage()||formDTO.getIsPage()) { |
|
|
if (null == formDTO.getIsPage()||formDTO.getIsPage()) { |
|
|
//分页
|
|
|
//分页
|
|
@ -572,7 +576,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
formDTO.getConditions(), |
|
|
formDTO.getConditions(), |
|
|
resultColumns, |
|
|
resultColumns, |
|
|
finalSubTables, |
|
|
finalSubTables, |
|
|
staffInfoCacheResult.getAgencyId(), finalStaffOrgPath,null, formDTO.getKeyword())); |
|
|
staffInfoCacheResult.getAgencyId(), finalStaffOrgPath,null, formDTO.getKeyword(), |
|
|
|
|
|
groupByTables)); |
|
|
}else{ |
|
|
}else{ |
|
|
List<Map<String,Object>> list=baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
List<Map<String,Object>> list=baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
formDTO.getFormCode(), |
|
|
formDTO.getFormCode(), |
|
@ -581,7 +586,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
finalSubTables, |
|
|
finalSubTables, |
|
|
staffInfoCacheResult.getAgencyId(), |
|
|
staffInfoCacheResult.getAgencyId(), |
|
|
staffOrgPath,null, |
|
|
staffOrgPath,null, |
|
|
formDTO.getKeyword()); |
|
|
formDTO.getKeyword(), |
|
|
|
|
|
groupByTables); |
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size()); |
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size()); |
|
|
pageInfo.setList(list); |
|
|
pageInfo.setList(list); |
|
|
} |
|
|
} |
|
@ -747,13 +753,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
List<ResiUserQueryValueDTO> conditions, |
|
|
List<ResiUserQueryValueDTO> conditions, |
|
|
String currentStaffAgencyId, |
|
|
String currentStaffAgencyId, |
|
|
String staffOrgPath){ |
|
|
String staffOrgPath){ |
|
|
List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions); |
|
|
// List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions);
|
|
|
|
|
|
Map<String,List<String>> map=getFinalSubables(customerId, formCode, resultTableName, conditions); |
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables, null, currentStaffAgencyId,staffOrgPath); |
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,map.get("finalSubTables"), null, currentStaffAgencyId,staffOrgPath,map.get("groupByTables")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@NotNull |
|
|
@NotNull |
|
|
public List<String> getFinalSubables(String customerId, String formCode, String resultTableName, List<ResiUserQueryValueDTO> conditions) { |
|
|
public Map<String,List<String>> getFinalSubables(String customerId, String formCode, String resultTableName, List<ResiUserQueryValueDTO> conditions) { |
|
|
|
|
|
Map<String,List<String>> map=new HashMap<>(); |
|
|
CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO(); |
|
|
CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO(); |
|
|
queryDTO.setCustomerId(customerId); |
|
|
queryDTO.setCustomerId(customerId); |
|
|
queryDTO.setFormCode(formCode); |
|
|
queryDTO.setFormCode(formCode); |
|
@ -769,12 +776,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
//最终关联的子表对应的sql:
|
|
|
//最终关联的子表对应的sql:
|
|
|
List<String> finalSubTables =new ArrayList<>(); |
|
|
List<String> finalSubTables =new ArrayList<>(); |
|
|
|
|
|
//groupBy用到的表
|
|
|
|
|
|
Set<String> groupByTables=new HashSet<>(); |
|
|
subTables.forEach(subTable->{ |
|
|
subTables.forEach(subTable->{ |
|
|
if(tables.contains(subTable.getTableName())){ |
|
|
if(tables.contains(subTable.getTableName())){ |
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
|
|
|
if(subTable.getSupportAdd()){ |
|
|
|
|
|
groupByTables.add(subTable.getTableName()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
return finalSubTables; |
|
|
map.put("finalSubTables",finalSubTables); |
|
|
|
|
|
map.put("groupByTables",groupByTables.stream().collect(Collectors.toList())); |
|
|
|
|
|
return map; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -1656,8 +1670,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<Map<String, Object>> dynamicQuery(String customerId, String formCode, String resultTableName, List<IcCustomExportResultDTO.SqlColumn> showSqlColumns, List<ResiUserQueryValueDTO> conditions, String currentStaffAgencyId, String staffOrgPath) { |
|
|
public List<Map<String, Object>> dynamicQuery(String customerId, String formCode, String resultTableName, List<IcCustomExportResultDTO.SqlColumn> showSqlColumns, List<ResiUserQueryValueDTO> conditions, String currentStaffAgencyId, String staffOrgPath) { |
|
|
List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions); |
|
|
// List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions);
|
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables,showSqlColumns,currentStaffAgencyId,staffOrgPath); |
|
|
Map<String,List<String>> map=getFinalSubables(customerId, formCode, resultTableName, conditions); |
|
|
|
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,map.get("finalSubTables"),showSqlColumns,currentStaffAgencyId,staffOrgPath,map.get("groupByTables")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|