From 27d64c41cc8a23c589ec033d16ec8d4ea5636f9f Mon Sep 17 00:00:00 2001 From: lzh Date: Sat, 13 Nov 2021 17:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0customerId=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResiCategoryStatsConfigController.java | 6 ++- .../ResiCategoryStatsConfigServiceImpl.java | 22 ++++++---- .../controller/StatsResiWarnController.java | 15 ++++--- .../com/epmet/dao/IcStatsResiWarnDao.java | 18 +++++++-- .../epmet/service/StatsResiWarnService.java | 6 +-- .../impl/StatsResiWarnServiceImpl.java | 40 ++++++++++++------- .../resources/mapper/IcStatsResiWarnDao.xml | 16 +++++--- 7 files changed, 81 insertions(+), 42 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java index fd4733c790..1e6de73f54 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java @@ -134,10 +134,11 @@ public class ResiCategoryStatsConfigController { } @PostMapping("resicategorystatslistshowd") - public Result> resiCategoryStatsListShowd(){ + public Result> resiCategoryStatsListShowd(@LoginUser TokenDto tokenDTO){ //获取预警配置列表 List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper() .lambda() + .eq(IcResiCategoryStatsConfigEntity::getCustomerId,tokenDTO.getCustomerId()) .eq(IcResiCategoryStatsConfigEntity::getStatus,"show") .orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); @@ -145,10 +146,11 @@ public class ResiCategoryStatsConfigController { } @PostMapping("resicategorywarnlist") - public Result> resiCategoryWarnList(){ + public Result> resiCategoryWarnList(@LoginUser TokenDto tokenDTO){ //获取预警配置列表 List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper() .lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,tokenDTO.getCustomerId()) .orderByAsc(IcResiCategoryWarnConfigEntity::getSort)); return new Result>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class)); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java index bdfba55c6a..bfeeaa0b9d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java @@ -49,14 +49,14 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf @Transactional(rollbackFor = Exception.class) public List list(String customerId) { //1.获取IC_FORM_ITEM 中 用于数据分析字段的 id 和label - List icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper().lambda().eq(IcFormItemEntity::getDataAnalyse, 1)); + List icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper().lambda().eq(IcFormItemEntity::getCustomerId,customerId).eq(IcFormItemEntity::getDataAnalyse, 1)); if(CollectionUtils.isEmpty(icFormItemEntityList)){ return new ArrayList<>(); } Set groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet()); List icFormItemGroupEntityList = new ArrayList<>(); if(!CollectionUtils.isEmpty(groupIds)){ - icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper().lambda().in(IcFormItemGroupEntity::getId, groupIds))); + icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper().lambda().eq(IcFormItemGroupEntity::getCustomerId,customerId).in(IcFormItemGroupEntity::getId, groupIds))); } //获取tableName和COLUMN_NAME Map tableColumnMap = new HashMap<>(); @@ -75,8 +75,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf }); //2.获取ic_resi_category_stats_config 和 ic_resi_category_warn_config 表中的数据 - List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); - List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); + List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId)); + List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)); //3.新增不存在的,删除不在tableColumnMap的 Map statsTableColumnMap = new HashMap<>(); @@ -129,8 +129,11 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf } //4.返回数据 - List statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda().orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); - List warnConfigList = icResiCategoryWarnConfigDao.selectList(null); + List statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda() + .eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId) + .orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); + List warnConfigList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)); Map warnMap =new HashMap<>(); warnConfigList.forEach(item->{ warnMap.put(item.getTableName()+"-"+item.getColumnName(),item); @@ -169,6 +172,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf return result; } IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId, icResiCategoryStatsConfigDTO.getCustomerId()) .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName())); @@ -207,6 +211,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){ //更新 IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId) .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName())); if(null == icResiCategoryWarnConfigEntity){ @@ -234,6 +239,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf }else if(IcResiCategoryStatsConfigConstant.WARN_NO.equals(formDTO.getWarn())){ //删除 icResiCategoryWarnConfigDao.delete(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId) .eq(IcResiCategoryWarnConfigEntity::getTableName,icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getColumnName,icResiCategoryStatsConfigDTO.getColumnName())); } @@ -267,8 +273,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf } icResiCategoryStatsConfigService.updateBatchById(entityList); //排序更新预警的 - List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); - List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); + List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId)); + List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)); if(CollectionUtils.isEmpty(warnConfigEntityList)){ return ; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java index 510c434264..0947eaaf82 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java @@ -57,29 +57,32 @@ public class StatsResiWarnController { private StatsResiWarnService statsResiWarnService; @PostMapping("list") - public Result list(@RequestBody StatsResiListFormDTO formDTO){ + public Result list(@LoginUser TokenDto tokenDto,@RequestBody StatsResiListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); - List icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel()); + String customerId = tokenDto.getCustomerId(); + List icStatsResiResultDTOList = statsResiWarnService.list(customerId,formDTO.getId(),formDTO.getLevel()); return new Result().ok(icStatsResiResultDTOList); } @PostMapping("buildingwarnlist") - public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ + public Result buildingWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class); + String customerId = tokenDto.getCustomerId(); String agencyID = formDTO.getAgencyId(); - List icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID); + List icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(customerId,agencyID); return new Result().ok(icStatsResiWarnBuildingResultDTOS); } @PostMapping("userwarnlist") - public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ + public Result userWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class); + String customerId = tokenDto.getCustomerId(); List buildingIdList = formDTO.getBuildingIdList(); if(CollectionUtils.isEmpty(buildingIdList)){ return new Result(); } - List icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList()); + List icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList()); return new Result().ok(icStatsResiWarnUserResultDTOS); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java index 5eea1c2c44..ef9fac802c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java @@ -35,17 +35,27 @@ import java.util.Map; @Mapper public interface IcStatsResiWarnDao extends BaseDao { - List selectResiWarnByAgencyId(@Param("agencyId") String agencyId); + List selectResiWarnByAgencyId(@Param("customerId") String customerId,@Param("agencyId") String agencyId); - List> userWarnList(@Param("buildingIdList") List buildingIdList, @Param("tableName") String tableName, @Param("columnName") String columnName); + List> userWarnList(@Param("customerId") String customerId, + @Param("buildingIdList") List buildingIdList, + @Param("tableName") String tableName, + @Param("columnName") String columnName); Integer countListByLevelAndCol( + @Param("customerId") String customerId, @Param("tableName") String tableName, @Param("columnName") String columnName, @Param("id")String id, @Param("level")String level); - List resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName); - IcStatsResiWarnEntity resiWarnById(@Param("tableName") String tableName,@Param("columnName") String columnName,@Param("icStatsResiWarn") IcStatsResiWarnEntity icStatsResiWarn); + List resiWarn(@Param("customerId") String customerId, + @Param("tableName") String tableName, + @Param("columnName") String columnName); + + IcStatsResiWarnEntity resiWarnById(@Param("customerId") String customerId, + @Param("tableName") String tableName, + @Param("columnName") String columnName, + @Param("icStatsResiWarn") IcStatsResiWarnEntity icStatsResiWarn); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java index 4ef4b6722a..64ccaa2fb1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java @@ -31,11 +31,11 @@ import java.util.List; */ public interface StatsResiWarnService{ - List buildingwWarnList(String agencyID); + List buildingwWarnList(String customerId,String agencyID); - List userWarnList(String configId, List buildingIdList); + List userWarnList(String customerId,String configId, List buildingIdList); - List list(String id, String level); + List list(String customerId,String id, String level); void resiWarn(String customerId); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java index 8a8af94e2b..4b2028501c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java @@ -52,7 +52,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { private IcResiUserDao icResiUserDao; @Override - public List buildingwWarnList(String agencyID) { + public List buildingwWarnList(String customerId,String agencyID) { List result = new ArrayList<>(); //feign获取当前需要预警的配置信息以及阈值 Result> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); @@ -81,7 +81,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { return resiWarnBuildingResultDTO; }).collect(Collectors.toList()); //统计数量 - List icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID); + List icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(customerId,agencyID); if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){ return result; } @@ -115,7 +115,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { } @Override - public List userWarnList(String configId, List buildingIdList) { + public List userWarnList(String customerId,String configId, List buildingIdList) { //feign根据buildingIdList 获取网格,小区,楼宇 信息 Result> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList); if (!buildingList.success() || null == buildingList.getData()) { @@ -137,7 +137,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); //根据buildingID,tableName he columnName获取名字 - List> maps = icStatsResiWarnDao.userWarnList(buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); + List> maps = icStatsResiWarnDao.userWarnList(customerId,buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); result.forEach(item->{ item.setConfigId(configId); List> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); @@ -147,7 +147,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { } @Override - public List list(String id, String level) { + public List list(String customerId,String id, String level) { //获取所有配置类项 getshow Result> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(); if (!statsResult.success() || null == statsResult.getData()) { @@ -164,7 +164,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { resultDTO.setHouseShowIcon(item.getHouseShowIcon()); resultDTO.setManagementIcon(item.getManagementIcon()); //根据id ,level 获取count - Integer count = icStatsResiWarnDao.countListByLevelAndCol(item.getTableName(),item.getColumnName(),id,level); + Integer count = icStatsResiWarnDao.countListByLevelAndCol(customerId,item.getTableName(),item.getColumnName(),id,level); resultDTO.setCount(count); result.add(resultDTO); }); @@ -187,10 +187,10 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { //保存数据 List icStatsResiWarnEntities = new ArrayList<>(); for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { - icStatsResiWarnDao.delete(new QueryWrapper().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId())); - List maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName()); + icStatsResiWarnDao.delete(new QueryWrapper().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId()).eq(IcStatsResiWarnEntity::getCustomerId,customerId)); + List maps = icStatsResiWarnDao.resiWarn(customerId,item.getTableName(), item.getColumnName()); if(CollectionUtils.isEmpty(maps)){ continue; } @@ -226,6 +226,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { if(null == icResiUserEntity){ return ; } + IcStatsResiWarnEntity query = new IcStatsResiWarnEntity(); + query.setAgencyId(icResiUserEntity.getAgencyId()); + query.setGridId(icResiUserEntity.getGridId()); + query.setNeighborHoodId(icResiUserEntity.getVillageId()); + query.setBuildingId(icResiUserEntity.getBuildId()); //保存数据 for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { @@ -233,11 +238,13 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao.selectOne(new QueryWrapper().lambda() .eq(IcStatsResiWarnEntity::getConfigId,item.getId()) + .eq(IcStatsResiWarnEntity::getCustomerId,customerId) .eq(IcStatsResiWarnEntity::getAgencyId, icResiUserEntity.getAgencyId()) .eq(IcStatsResiWarnEntity::getGridId, icResiUserEntity.getGridId()) .eq(IcStatsResiWarnEntity::getNeighborHoodId, icResiUserEntity.getVillageId()) .eq(IcStatsResiWarnEntity::getBuildingId, icResiUserEntity.getBuildId())); - + //统计数量 + IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(customerId,item.getTableName(), item.getColumnName(),query); if(null == icStatsResiWarn){ //如果不存在,新增统计数量 icStatsResiWarn = new IcStatsResiWarnEntity(); @@ -248,18 +255,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { icStatsResiWarn.setBuildingId(icResiUserEntity.getBuildId()); icStatsResiWarn.setConfigId(item.getId()); icStatsResiWarn.setCustomerId(customerId); - IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn); + if(null == resiWarnEntity){ - continue; + icStatsResiWarn.setCount(0); + }else{ + icStatsResiWarn.setCount(resiWarnEntity.getCount()); } - icStatsResiWarn.setCount(resiWarnEntity.getCount()); icStatsResiWarnDao.insert(icStatsResiWarn); }else{ //如果存在,更新统计数量 - IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn); - icStatsResiWarn.setCount(resiWarnEntity.getCount()); + if(null == resiWarnEntity){ + icStatsResiWarn.setCount(0); + }else{ + icStatsResiWarn.setCount(resiWarnEntity.getCount()); + } icStatsResiWarn.setCustomerId(customerId); icStatsResiWarnDao.updateById(icStatsResiWarn); + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml index 79a5f7499b..4a4a2a6cc3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml @@ -29,6 +29,7 @@ AND (AGENCY_ID = #{agencyId} or CONCAT(':',AGENCY_PIDS, ':') like CONCAT('%:',#{agencyId},':%')) + and CUSTOMER_ID = #{customerId} @@ -63,7 +66,7 @@ and ID in ( - select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' + select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' ) @@ -78,6 +81,7 @@ AND BUILD_ID = #{id} + and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' @@ -97,10 +101,11 @@ and ID in ( - select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' + select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' ) - and DEL_FLAG = '0' + and CUSTOMER_ID = #{customerId} + and DEL_FLAG = '0' group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID