From f96265706c04836e5f26e11759052add631658e8 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Tue, 21 Nov 2023 17:04:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=88=BF=E5=B1=8B?= =?UTF-8?q?=E6=B1=87=E6=80=BB=E5=88=97=E8=A1=A8=E6=89=A7=E8=A1=8C=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=20=20--renpc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cm/population/dao/house/IHouseDao.java | 2 ++ .../population/pojo/dtos/house/HouseDTO.java | 10 +++++++ .../service/house/impl/HouseServiceImpl.java | 10 +++---- .../impl/PopulationServiceImpl.java | 2 +- .../mybatis/mapper/house/house-mapper.xml | 30 ++++++++++++++++++- 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/cm/population/dao/house/IHouseDao.java b/src/main/java/com/cm/population/dao/house/IHouseDao.java index 28b66f6..e14cf6e 100644 --- a/src/main/java/com/cm/population/dao/house/IHouseDao.java +++ b/src/main/java/com/cm/population/dao/house/IHouseDao.java @@ -124,4 +124,6 @@ public interface IHouseDao { * @return */ List findPopulation(Map params); + + List listForAll(Map params); } \ No newline at end of file diff --git a/src/main/java/com/cm/population/pojo/dtos/house/HouseDTO.java b/src/main/java/com/cm/population/pojo/dtos/house/HouseDTO.java index 5fb1add..2456dde 100644 --- a/src/main/java/com/cm/population/pojo/dtos/house/HouseDTO.java +++ b/src/main/java/com/cm/population/pojo/dtos/house/HouseDTO.java @@ -129,6 +129,8 @@ public class HouseDTO { private String houseType; @ApiModelProperty(name = "populationVOList", value = "同住人信息") private List populationDTOList; + @ApiModelProperty(name = "count", value = "房屋人员") + private Integer count; public String getHouseId() { return houseId; @@ -577,4 +579,12 @@ public class HouseDTO { public void setPopulationDTOList(List populationDTOList) { this.populationDTOList = populationDTOList; } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } } diff --git a/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java b/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java index d1a811a..f486192 100644 --- a/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java +++ b/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java @@ -262,7 +262,7 @@ public class HouseServiceImpl extends AbstractService implements IHouseService { batchHouseDTO.setUnitCount(unitNum.toString()); // 获取当前楼栋下的所有房屋信息 - List houseDTOList = houseDao.list(params); + List houseDTOList = houseDao.listForAll(params); List floorList = new ArrayList<>(); for (int i = 1; i <= floorsNum; i++) { @@ -281,7 +281,7 @@ public class HouseServiceImpl extends AbstractService implements IHouseService { BatchHouseDTO.House house = new BatchHouseDTO.House(); if (null != houseDTO.getAffiliationFloors()) { if (i == Integer.valueOf(houseDTO.getAffiliationFloors())) { - if (null != houseDTO.getAffiliatedUnit()) { + if (null != houseDTO.getAffiliationUnit()) { if (j == Integer.valueOf(houseDTO.getAffiliationUnit())) { house.setIsCreator(0); house.setPopulationCount(0); @@ -291,9 +291,9 @@ public class HouseServiceImpl extends AbstractService implements IHouseService { if (userId.equals(houseDTO.getCreator()) || isAdmin()) { house.setIsCreator(1); // 获取当前房屋内的人数 - params.put("houseId", houseDTO.getHouseId()); - Integer count = populationService.count(params); - house.setPopulationCount(count); + /*params.put("houseId", houseDTO.getHouseId()); + Integer count = populationService.count(params);*/ + house.setPopulationCount(houseDTO.getCount()); } houseList.add(house); } diff --git a/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java b/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java index a033b28..19d4781 100644 --- a/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java +++ b/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java @@ -361,7 +361,7 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio // 获取人员 PopulationInfoBaseDTO base = populationInfoService.getBase(populationDTO.getPopulationInfoId()); - populationInfoService.getTuoMin(base); + // populationInfoService.getTuoMin(base); populationInfoHouseDTO.setPopulationInfoBaseDTO(base); populationDTO.setPopulationInfoHouseDTO(populationInfoHouseDTO); diff --git a/src/main/resources/mybatis/mapper/house/house-mapper.xml b/src/main/resources/mybatis/mapper/house/house-mapper.xml index 54c18b4..5f3491c 100644 --- a/src/main/resources/mybatis/mapper/house/house-mapper.xml +++ b/src/main/resources/mybatis/mapper/house/house-mapper.xml @@ -57,6 +57,7 @@ + @@ -795,7 +796,7 @@ hp.population_info_id = #{populationInfoId} ) - ORDER BY house_num ASC + ORDER BY affiliation_unit, affiliation_floors, house_num ASC @@ -1054,4 +1055,31 @@ + + \ No newline at end of file From 507f00db637be6bf79c68410ab3823f6c6117fd3 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Tue, 21 Nov 2023 19:00:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=88=BF=E5=B1=8B?= =?UTF-8?q?=E6=B1=87=E6=80=BB=E5=88=97=E8=A1=A8=E6=89=A7=E8=A1=8C=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=20=20--renpc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cm/population/service/house/impl/HouseServiceImpl.java | 7 +++++++ src/main/resources/mybatis/mapper/house/house-mapper.xml | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java b/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java index f486192..bab565c 100644 --- a/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java +++ b/src/main/java/com/cm/population/service/house/impl/HouseServiceImpl.java @@ -36,10 +36,12 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.stream.Collectors; /** * @ClassName: HouseServiceImpl @@ -247,6 +249,7 @@ public class HouseServiceImpl extends AbstractService implements IHouseService { @Override public BatchHouseDTO getAllHouse(Map params) { + long startTime = System.currentTimeMillis(); // 获取当前登陆人ID UserInfoBO userInfoBO = this.securityComponent.getCurrentUser(); String userId = userInfoBO.getUserId(); @@ -265,6 +268,7 @@ public class HouseServiceImpl extends AbstractService implements IHouseService { List houseDTOList = houseDao.listForAll(params); List floorList = new ArrayList<>(); + for (int i = 1; i <= floorsNum; i++) { BatchHouseDTO.Floor floor = new BatchHouseDTO.Floor(); floor.setName(i + "层"); @@ -329,7 +333,10 @@ public class HouseServiceImpl extends AbstractService implements IHouseService { floor.setUnits(new ArrayList<>()); } } + long endTime = System.currentTimeMillis(); + long executeTime = endTime - startTime; + System.out.println("代码执行时间:" + executeTime + "毫秒"); return batchHouseDTO; } diff --git a/src/main/resources/mybatis/mapper/house/house-mapper.xml b/src/main/resources/mybatis/mapper/house/house-mapper.xml index 5f3491c..386544b 100644 --- a/src/main/resources/mybatis/mapper/house/house-mapper.xml +++ b/src/main/resources/mybatis/mapper/house/house-mapper.xml @@ -1080,6 +1080,10 @@ t1.house_num, t1.creator, t1.gmt_create + ORDER BY + t1.affiliation_unit, + t1.affiliation_floors, + t1.house_num ASC \ No newline at end of file From 579f8ac24b4ac3c815f8614a3128345d75f8cf52 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Wed, 22 Nov 2023 10:04:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=88=BF=E5=B1=8B=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=20=20--renpc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/mapper/house/house-mapper.xml | 1000 ++++++++--------- 1 file changed, 496 insertions(+), 504 deletions(-) diff --git a/src/main/resources/mybatis/mapper/house/house-mapper.xml b/src/main/resources/mybatis/mapper/house/house-mapper.xml index 386544b..494d10b 100644 --- a/src/main/resources/mybatis/mapper/house/house-mapper.xml +++ b/src/main/resources/mybatis/mapper/house/house-mapper.xml @@ -187,125 +187,122 @@ - INSERT INTO house_house( - house_id, - street, - street_name, - community, - community_name, - residential_id, - residential_name, - building_id, - building_name, - affiliation_unit, - affiliation_floors, - house_num, - category_id, - category_name, - nature_id, - nature_name, - type_id, - type_name, - structure_id, - structure_name, - building_purpose_id, - building_purpose_name, - room_num, - room_area, - room_use_id, - room_use_name, - danger_id, - danger_name, - certificate_num, - registration_date, - affiliated_unit, - is_rental, - is_vacant, - lodge_type_id, - lodge_type_name, - rental_purposes, - homeowner, - document_id, - document_name, - document_num, - phone, - custodian, - custodian_document_id, - custodian_document_name, - custodian_document_num, - custodian_phone, - relationship_homeowner, - creator, - gmt_create, - modifier, - gmt_modified, - is_delete - ) VALUES( - #{houseId}, - #{street}, - #{streetName}, - #{community}, - #{communityName}, - #{residentialId}, - #{residentialName}, - #{buildingId}, - #{buildingName}, - #{affiliationUnit}, - #{affiliationFloors}, - #{houseNum}, - #{categoryId}, - #{categoryName}, - #{natureId}, - #{natureName}, - #{typeId}, - #{typeName}, - #{structureId}, - #{structureName}, - #{buildingPurposeId}, - #{buildingPurposeName}, - #{roomNum}, - #{roomArea}, - #{roomUseId}, - #{roomUseName}, - #{dangerId}, - #{dangerName}, - #{certificateNum}, - #{registrationDate}, - #{affiliatedUnit}, - #{isRental}, - #{isVacant}, - #{lodgeTypeId}, - #{lodgeTypeName}, - #{rentalPurposes}, - #{homeowner}, - #{documentId}, - #{documentName}, - #{documentNum}, - #{phone}, - #{custodian}, - #{custodianDocumentId}, - #{custodianDocumentName}, - #{custodianDocumentNum}, - #{custodianPhone}, - #{relationshipHomeowner}, - #{creator}, - #{gmtCreate}, - #{modifier}, - #{gmtModified}, - #{isDelete} - ) + INSERT INTO house_house(house_id, + street, + street_name, + community, + community_name, + residential_id, + residential_name, + building_id, + building_name, + affiliation_unit, + affiliation_floors, + house_num, + category_id, + category_name, + nature_id, + nature_name, + type_id, + type_name, + structure_id, + structure_name, + building_purpose_id, + building_purpose_name, + room_num, + room_area, + room_use_id, + room_use_name, + danger_id, + danger_name, + certificate_num, + registration_date, + affiliated_unit, + is_rental, + is_vacant, + lodge_type_id, + lodge_type_name, + rental_purposes, + homeowner, + document_id, + document_name, + document_num, + phone, + custodian, + custodian_document_id, + custodian_document_name, + custodian_document_num, + custodian_phone, + relationship_homeowner, + creator, + gmt_create, + modifier, + gmt_modified, + is_delete) + VALUES (#{houseId}, + #{street}, + #{streetName}, + #{community}, + #{communityName}, + #{residentialId}, + #{residentialName}, + #{buildingId}, + #{buildingName}, + #{affiliationUnit}, + #{affiliationFloors}, + #{houseNum}, + #{categoryId}, + #{categoryName}, + #{natureId}, + #{natureName}, + #{typeId}, + #{typeName}, + #{structureId}, + #{structureName}, + #{buildingPurposeId}, + #{buildingPurposeName}, + #{roomNum}, + #{roomArea}, + #{roomUseId}, + #{roomUseName}, + #{dangerId}, + #{dangerName}, + #{certificateNum}, + #{registrationDate}, + #{affiliatedUnit}, + #{isRental}, + #{isVacant}, + #{lodgeTypeId}, + #{lodgeTypeName}, + #{rentalPurposes}, + #{homeowner}, + #{documentId}, + #{documentName}, + #{documentNum}, + #{phone}, + #{custodian}, + #{custodianDocumentId}, + #{custodianDocumentName}, + #{custodianDocumentNum}, + #{custodianPhone}, + #{relationshipHomeowner}, + #{creator}, + #{gmtCreate}, + #{modifier}, + #{gmtModified}, + #{isDelete}) UPDATE - house_house + house_house SET - gmt_modified = #{gmtModified}, - modifier = #{modifier}, - is_delete = 1 + gmt_modified = #{gmtModified}, + modifier = #{modifier}, + is_delete = 1 WHERE - house_id IN + house_id IN #{houseIds[${index}]} @@ -314,9 +311,9 @@ DELETE FROM - house_house + house_house WHERE - house_id IN + house_id IN #{houseIds[${index}]} @@ -325,7 +322,7 @@ UPDATE - house_house + house_house SET street = #{street}, @@ -465,264 +462,264 @@ relationship_homeowner = #{relationshipHomeowner}, - gmt_modified = #{gmtModified}, - modifier = #{modifier}, - house_id = house_id + gmt_modified = #{gmtModified}, + modifier = #{modifier}, + house_id = house_id WHERE - house_id = #{houseId} + house_id = #{houseId} SELECT - t1.house_id, - t1.street, - t1.street_name, - t1.community, - t1.community_name, - t1.residential_id, - t1.residential_name, - t1.building_id, - t1.building_name, - t1.affiliation_unit, - t1.affiliation_floors, - t1.house_num, - t1.category_id, - t1.category_name, - t1.nature_id, - t1.nature_name, - t1.type_id, - t1.type_name, - t1.structure_id, - t1.structure_name, - t1.building_purpose_id, - t1.building_purpose_name, - t1.room_num, - t1.room_area, - t1.room_use_id, - t1.room_use_name, - t1.danger_id, - t1.danger_name, - t1.certificate_num, - t1.registration_date, - t1.affiliated_unit, - t1.is_rental, - t1.is_vacant, - t1.lodge_type_id, - t1.lodge_type_name, - t1.rental_purposes, - t1.homeowner, - t1.document_id, - t1.document_name, - t1.document_num, - t1.phone, - t1.custodian, - t1.custodian_document_id, - t1.custodian_document_name, - t1.custodian_document_num, - t1.custodian_phone, - t1.relationship_homeowner, - t1.creator, - t1.gmt_create, - t1.modifier, - t1.gmt_modified, - t1.is_delete + t1.house_id, + t1.street, + t1.street_name, + t1.community, + t1.community_name, + t1.residential_id, + t1.residential_name, + t1.building_id, + t1.building_name, + t1.affiliation_unit, + t1.affiliation_floors, + t1.house_num, + t1.category_id, + t1.category_name, + t1.nature_id, + t1.nature_name, + t1.type_id, + t1.type_name, + t1.structure_id, + t1.structure_name, + t1.building_purpose_id, + t1.building_purpose_name, + t1.room_num, + t1.room_area, + t1.room_use_id, + t1.room_use_name, + t1.danger_id, + t1.danger_name, + t1.certificate_num, + t1.registration_date, + t1.affiliated_unit, + t1.is_rental, + t1.is_vacant, + t1.lodge_type_id, + t1.lodge_type_name, + t1.rental_purposes, + t1.homeowner, + t1.document_id, + t1.document_name, + t1.document_num, + t1.phone, + t1.custodian, + t1.custodian_document_id, + t1.custodian_document_name, + t1.custodian_document_num, + t1.custodian_phone, + t1.relationship_homeowner, + t1.creator, + t1.gmt_create, + t1.modifier, + t1.gmt_modified, + t1.is_delete FROM - house_house t1 + house_house t1 WHERE - t1.is_delete = 0 + t1.is_delete = 0 - AND ( + AND ( t1.id LIKE CONCAT('%', #{keywords}, '%') - ) + ) - AND + AND LEFT(t1.gmt_create, 10) = ]]> #{startTime} - AND + AND LEFT(t1.gmt_create, 10) #{endTime} - AND + AND t1.house_id IN #{houseIds[${index}]} @@ -965,30 +962,27 @@ SELECT - t1.house_id, - t1.building_id, - t1.affiliation_unit, - t1.affiliation_floors, - t1.house_num, - t1.creator, - t1.gmt_create, - COUNT(t2.house_id) as count, - 1 + t1.house_id, + t1.building_id, + t1.affiliation_unit, + t1.affiliation_floors, + t1.house_num, + t1.creator, + t1.gmt_create, + COUNT(t2.house_id) as count, + 1 FROM - house_house t1 LEFT JOIN house_population t2 ON t1.house_id = t2.house_id + house_house t1 LEFT JOIN house_population t2 ON t1.house_id = t2.house_id WHERE - t1.is_delete = 0 + t1.is_delete = 0 AND building_id = #{buildingId} @@ -1081,9 +1075,7 @@ t1.creator, t1.gmt_create ORDER BY - t1.affiliation_unit, - t1.affiliation_floors, - t1.house_num ASC + (t1.affiliation_unit + 0), (t1.affiliation_floors + 0), (t1.house_num + 0) ASC \ No newline at end of file