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] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=88=BF=E5=B1=8B=E6=B1=87?= =?UTF-8?q?=E6=80=BB=E5=88=97=E8=A1=A8=E6=89=A7=E8=A1=8C=E9=80=9F=E5=BA=A6?= =?UTF-8?q?=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