diff --git a/src/main/java/com/cm/systemcity/service/citybuilding/ICityBuildingService.java b/src/main/java/com/cm/systemcity/service/citybuilding/ICityBuildingService.java index a907948..027b2af 100644 --- a/src/main/java/com/cm/systemcity/service/citybuilding/ICityBuildingService.java +++ b/src/main/java/com/cm/systemcity/service/citybuilding/ICityBuildingService.java @@ -25,11 +25,12 @@ public interface ICityBuildingService { /** * 根据名称获取 + * @param districtName * @param buildingName * @return * @throws SearchException */ - CityBuildingDTO getCityBuildingByName(String buildingName) throws SearchException; + CityBuildingDTO getCityBuildingByName(String districtName, String buildingName) throws SearchException; /** * 获取小区的楼宇 * @param districtIds diff --git a/src/main/java/com/cm/systemcity/service/citybuilding/impl/CityBuildingServiceImpl.java b/src/main/java/com/cm/systemcity/service/citybuilding/impl/CityBuildingServiceImpl.java index 6278ac5..0be0dcf 100644 --- a/src/main/java/com/cm/systemcity/service/citybuilding/impl/CityBuildingServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/citybuilding/impl/CityBuildingServiceImpl.java @@ -383,8 +383,9 @@ public class CityBuildingServiceImpl extends AbstractService implements ICityBui } @Override - public CityBuildingDTO getCityBuildingByName(String buildingName) throws SearchException { + public CityBuildingDTO getCityBuildingByName(String districtName, String buildingName) throws SearchException { Map params = super.getHashMap(1); + params.put("districtName", districtName); params.put("buildingName", buildingName); return cityBuildingDao.getCityBuilding(params); } diff --git a/src/main/java/com/cm/systemcity/utils/ImportExcelHelper.java b/src/main/java/com/cm/systemcity/utils/ImportExcelHelper.java index 493ad08..5724fb6 100644 --- a/src/main/java/com/cm/systemcity/utils/ImportExcelHelper.java +++ b/src/main/java/com/cm/systemcity/utils/ImportExcelHelper.java @@ -120,11 +120,12 @@ public class ImportExcelHelper { } Map param = new HashMap<>(); param.put("districtName", buildingHouseModel.getDistrictName()); + param.put("buildingName", buildingHouseModel.getCityBuildingName()); CityDistrictDTO cityDistrictDTO = cityDistrictService.getCityDistrictByName(buildingHouseModel.getDistrictName()); if(null != cityDistrictDTO) { buildingHouseModel.setDistrictId(cityDistrictDTO.getCityDistrictId()); } - CityBuildingDTO cityBuildingDTO = cityBuildingService.getCityBuildingByName(buildingHouseModel.getCityBuildingName()); + CityBuildingDTO cityBuildingDTO = cityBuildingService.getCityBuildingByName(buildingHouseModel.getDistrictName(), buildingHouseModel.getCityBuildingName()); if(null != cityBuildingDTO) { buildingHouseModel.setCityBuildingId(cityBuildingDTO.getCityBuildingId()); } diff --git a/src/main/resources/mybatis/mapper/citybuilding/citybuilding-mapper.xml b/src/main/resources/mybatis/mapper/citybuilding/citybuilding-mapper.xml index 5314142..8e20d99 100644 --- a/src/main/resources/mybatis/mapper/citybuilding/citybuilding-mapper.xml +++ b/src/main/resources/mybatis/mapper/citybuilding/citybuilding-mapper.xml @@ -137,10 +137,15 @@ AND t1.city_building_id = #{cityBuildingId} + + AND + t1.district_name = #{districtName} + AND t1.building_name = #{buildingName} + LIMIT 0, 1