diff --git a/src/main/java/com/cm/systemcity/dao/buildinghouse/IBuildingHouseDao.java b/src/main/java/com/cm/systemcity/dao/buildinghouse/IBuildingHouseDao.java index 9965ff9..cb37e93 100644 --- a/src/main/java/com/cm/systemcity/dao/buildinghouse/IBuildingHouseDao.java +++ b/src/main/java/com/cm/systemcity/dao/buildinghouse/IBuildingHouseDao.java @@ -85,4 +85,11 @@ public interface IBuildingHouseDao { * @throws RemoveException */ void deleteNoData(Map params) throws RemoveException; + + /** + * 删除楼宇时,删除楼宇下的房屋信息 + * @param params + * @throws RemoveException + */ + void removeData(Map params) throws RemoveException; } \ No newline at end of file diff --git a/src/main/java/com/cm/systemcity/service/buildinghouse/IBuildingHouseService.java b/src/main/java/com/cm/systemcity/service/buildinghouse/IBuildingHouseService.java index de2cd9e..6309015 100644 --- a/src/main/java/com/cm/systemcity/service/buildinghouse/IBuildingHouseService.java +++ b/src/main/java/com/cm/systemcity/service/buildinghouse/IBuildingHouseService.java @@ -141,4 +141,10 @@ public interface IBuildingHouseService { */ void deleteNoData(Map params); + /** + * 删除楼宇时,删除楼宇下的房屋信息 + * @param token + * @param cityBuildingId + */ + void removeData(String token, String cityBuildingId); } \ No newline at end of file diff --git a/src/main/java/com/cm/systemcity/service/buildinghouse/impl/BuildingHouseServiceImpl.java b/src/main/java/com/cm/systemcity/service/buildinghouse/impl/BuildingHouseServiceImpl.java index 6186fcc..b462d45 100644 --- a/src/main/java/com/cm/systemcity/service/buildinghouse/impl/BuildingHouseServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/buildinghouse/impl/BuildingHouseServiceImpl.java @@ -135,4 +135,16 @@ public class BuildingHouseServiceImpl extends AbstractService implements IBuildi buildingHouseDao.deleteNoData(params); } + @Override + public void removeData(String token, String cityBuildingIds) { + Map params = new HashMap<>(); + params.put("cityBuildingIds", Arrays.asList(cityBuildingIds.split("_"))); + if (token != null) { + setUpdateInfo(token, params); + } else { + setUpdateInfo(params); + } + buildingHouseDao.removeData(params); + } + } \ No newline at end of file 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 242bf3a..b7f0088 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 @@ -178,6 +178,7 @@ public class CityBuildingServiceImpl extends AbstractService implements ICityBui setUpdateInfo(params); } cityBuildingDao.removeCityBuilding(params); + buildingHouseService.removeData(token, ids); } @Override @@ -214,7 +215,7 @@ public class CityBuildingServiceImpl extends AbstractService implements ICityBui } else { setUpdateInfo(params); } - updateHouse(cityBuildingId, cityBuildingVO); + updateHouse(token, cityBuildingId, cityBuildingVO); cityBuildingDao.updateCityBuilding(params); } @@ -223,9 +224,13 @@ public class CityBuildingServiceImpl extends AbstractService implements ICityBui * @param cityBuildingId * @param cityBuildingVO */ - private void updateHouse(String cityBuildingId, CityBuildingVO cityBuildingVO) throws Exception { + private void updateHouse(String token, String cityBuildingId, CityBuildingVO cityBuildingVO) throws Exception { Map params = new HashMap<>(2); - setUpdateInfo(params); + if (token != null) { + setUpdateInfo(token, params); + } else { + setUpdateInfo(params); + } params.put("cityBuildingId", cityBuildingId); // 先获取到修改之前的楼宇信息,判断哪些数据发生了改变,根据改变的数据,进行相关的房屋信息修改 CityBuildingDTO cityBuildingDTO = cityBuildingDao.getCityBuilding(params); @@ -238,22 +243,22 @@ public class CityBuildingServiceImpl extends AbstractService implements ICityBui buildingHouseVO.setCityBuildingId(cityBuildingId); buildingHouseVO.setDistrictName(cityBuildingVO.getDistrictName()); buildingHouseVO.setDistrictId(cityBuildingVO.getDistrictId()); - buildingHouseService.update(null, buildingHouseVO); + buildingHouseService.update(token,null, buildingHouseVO); } // 楼宇名称 if(!cityBuildingDTO.getBuildingName().equals(cityBuildingVO.getBuildingName())) { BuildingHouseVO buildingHouseVO = new BuildingHouseVO(); buildingHouseVO.setCityBuildingId(cityBuildingId); buildingHouseVO.setCityBuildingName(cityBuildingVO.getBuildingName()); - buildingHouseService.update(null, buildingHouseVO); + buildingHouseService.update(token,null, buildingHouseVO); } // 楼宇编号 if(!cityBuildingDTO.getBuildingNum().equals(cityBuildingVO.getBuildingNum())) { BuildingHouseVO buildingHouseVO = new BuildingHouseVO(); buildingHouseVO.setCityBuildingId(cityBuildingId); - buildingHouseVO.setNewHouseNumber(cityBuildingVO.getBuildingNum()); - buildingHouseVO.setOldHouseNumber(cityBuildingDTO.getBuildingNum()); - buildingHouseService.update(null, buildingHouseVO); + buildingHouseVO.setNewHouseNumber(cityBuildingVO.getBuildingNum() + "栋"); + buildingHouseVO.setOldHouseNumber(cityBuildingDTO.getBuildingNum() + "栋"); + buildingHouseService.update(token,null, buildingHouseVO); } // 楼宇层数 if(!cityBuildingDTO.getBuildingFloor().equals(cityBuildingVO.getBuildingFloor())) { diff --git a/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml b/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml index 8429583..27680a7 100644 --- a/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml +++ b/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml @@ -202,8 +202,13 @@ t1.is_delete = 0 AND ( - - t1.id LIKE CONCAT('%', #{keywords}, '%') + t1.city_building_name LIKE CONCAT('%', #{keywords}, '%') + OR + t1.district_name LIKE CONCAT('%', #{keywords}, '%') + OR + t1.owner_name LIKE CONCAT('%', #{keywords}, '%') + OR + t1.owner_card LIKE CONCAT('%', #{keywords}, '%') ) @@ -263,4 +268,22 @@ ) + + UPDATE + city_building_house + SET + gmt_modified = #{gmtModified}, + modifier = #{modifier}, + is_delete = 1 + WHERE + 1 = 1 + + AND + city_building_id IN + + #{cityBuildingIds[${index}]} + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/citybuilding/save-citybuilding.html b/src/main/resources/static/route/citybuilding/save-citybuilding.html index de5fbe7..70eb8ea 100644 --- a/src/main/resources/static/route/citybuilding/save-citybuilding.html +++ b/src/main/resources/static/route/citybuilding/save-citybuilding.html @@ -41,6 +41,12 @@ +
+ +
+ +
+
@@ -53,12 +59,6 @@
-
- -
- -
-