perf(): 优化安全环境检查getOne查询

dev
lishiwei 2026-07-02 09:05:41 +08:00
parent b64c1048a0
commit a5620c3a27
2 changed files with 6 additions and 0 deletions

View File

@ -233,6 +233,8 @@ public class SafetyEnvironmentalInspectionAddExe {
queryWrapper.eq("key_project_id", cmd.getKeyProjectId());
queryWrapper.ne("apply_status", 0);
queryWrapper.eq("delete_enum", "FALSE");
queryWrapper.orderByDesc("update_time");
queryWrapper.last("limit 1");
KeyProjectDO keyProjectDO = keyProjectRepository.getOne(queryWrapper);
List<SafetyEnvironmentalInspectionUserDO> messageUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 2);
// todo 可能会导致异步任务被线程池拒绝

View File

@ -256,6 +256,8 @@ public class SafetyEnvironmentalInspectionUpdateExe {
queryWrapper.eq("key_project_id", cmd.getKeyProjectId());
queryWrapper.ne("apply_status", 0);
queryWrapper.eq("delete_enum", "FALSE");
queryWrapper.orderByDesc("update_time");
queryWrapper.last("limit 1");
KeyProjectDO keyProjectDO = keyProjectRepository.getOne(queryWrapper);
List<SafetyEnvironmentalInspectionUserDO> messageUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 2);
for (SafetyEnvironmentalInspectionUserDO insUser : messageUserList){
@ -425,6 +427,8 @@ public class SafetyEnvironmentalInspectionUpdateExe {
queryWrapper.eq("key_project_id", cmd.getKeyProjectId());
queryWrapper.ne("apply_status", 0);
queryWrapper.eq("delete_enum", "FALSE");
queryWrapper.orderByDesc("update_time");
queryWrapper.last("limit 1");
KeyProjectDO keyProjectDO = keyProjectRepository.getOne(queryWrapper);
List<SafetyEnvironmentalInspectionUserDO> messageUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(cmd.getInspectionId(), 5);
for (SafetyEnvironmentalInspectionUserDO insUser : messageUserList){