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