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