优化房屋汇总列表执行速度 --renpc

This commit is contained in:
Renpc-kilig 2023-11-21 19:00:17 +08:00
parent f96265706c
commit 507f00db63
2 changed files with 11 additions and 0 deletions

View File

@ -36,10 +36,12 @@ import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/** /**
* @ClassName: HouseServiceImpl * @ClassName: HouseServiceImpl
@ -247,6 +249,7 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
@Override @Override
public BatchHouseDTO getAllHouse(Map<String, Object> params) { public BatchHouseDTO getAllHouse(Map<String, Object> params) {
long startTime = System.currentTimeMillis();
// 获取当前登陆人ID // 获取当前登陆人ID
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser(); UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
String userId = userInfoBO.getUserId(); String userId = userInfoBO.getUserId();
@ -265,6 +268,7 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
List<HouseDTO> houseDTOList = houseDao.listForAll(params); List<HouseDTO> houseDTOList = houseDao.listForAll(params);
List<BatchHouseDTO.Floor> floorList = new ArrayList<>(); List<BatchHouseDTO.Floor> floorList = new ArrayList<>();
for (int i = 1; i <= floorsNum; i++) { for (int i = 1; i <= floorsNum; i++) {
BatchHouseDTO.Floor floor = new BatchHouseDTO.Floor(); BatchHouseDTO.Floor floor = new BatchHouseDTO.Floor();
floor.setName(i + ""); floor.setName(i + "");
@ -329,7 +333,10 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
floor.setUnits(new ArrayList<>()); floor.setUnits(new ArrayList<>());
} }
} }
long endTime = System.currentTimeMillis();
long executeTime = endTime - startTime;
System.out.println("代码执行时间:" + executeTime + "毫秒");
return batchHouseDTO; return batchHouseDTO;
} }

View File

@ -1080,6 +1080,10 @@
t1.house_num, t1.house_num,
t1.creator, t1.creator,
t1.gmt_create t1.gmt_create
ORDER BY
t1.affiliation_unit,
t1.affiliation_floors,
t1.house_num ASC
</select> </select>
</mapper> </mapper>