From 90a1495b9d765c9e1d48f689dbcf977cbdb2768e Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期二, 31 十二月 2024 17:23:13 +0800
Subject: [PATCH] 模型结果修改为存在唯一索引则修改,不存在插入。避免死锁问题

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java
index 2ab3194..6095b8c 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.iailab.framework.common.page.PageData;
+import com.iailab.framework.common.service.impl.BaseServiceImpl;
 import com.iailab.framework.common.service.impl.CrudServiceImpl;
 import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.module.model.mpk.dao.MpkFileDao;
@@ -13,6 +14,7 @@
 import com.iailab.module.model.mpk.dto.ProjectModelDTO;
 import com.iailab.module.model.mpk.dto.ProjectPackageHistoryDTO;
 import com.iailab.module.model.mpk.entity.ProjectEntity;
+import com.iailab.module.model.mpk.entity.ProjectPackageHistoryEntity;
 import com.iailab.module.model.mpk.service.ProjectModelService;
 import com.iailab.module.model.mpk.service.ProjectPackageHistoryModelService;
 import com.iailab.module.model.mpk.service.ProjectPackageHistoryService;
@@ -34,7 +36,7 @@
  **/
 @Service
 @Slf4j
-public class ProjectServiceImpl extends CrudServiceImpl<ProjectDao, ProjectEntity, ProjectDTO> implements ProjectService {
+public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntity> implements ProjectService {
 
     @Autowired
     ProjectModelService projectModelService;
@@ -47,9 +49,9 @@
 
     @Override
     public PageData<ProjectDTO> page(Map<String, Object> params) {
-        IPage<ProjectDTO> page = baseDao.getPageList(
+        IPage<ProjectEntity> page = baseDao.selectPage(
                 getPage(params, null, false),
-                params
+                getWrapper(params)
         );
 
         return getPageData(page, ProjectDTO.class);
@@ -121,7 +123,7 @@
         //删除备份文件
         Map<String,Object> map = new HashMap<>();
         map.put("projectId",id);
-        List<ProjectPackageHistoryDTO> list = projectPackageHistoryService.list(map);
+        List<ProjectPackageHistoryEntity> list = projectPackageHistoryService.list(map);
         list.forEach(e -> {
             File file = new File(e.getFilePath());
             if (file.exists()) {
@@ -161,14 +163,15 @@
         return new PageData<>(list,total);
     }
 
-    @Override
     public QueryWrapper<ProjectEntity> getWrapper(Map<String, Object> params){
         String id = (String)params.get("id");
         String projectName = (String)params.get("projectName");
+        String projectCode = (String)params.get("projectCode");
 
         QueryWrapper<ProjectEntity> wrapper = new QueryWrapper<>();
         wrapper.eq(StringUtils.isNotBlank(id), "id", id)
-                .like(StringUtils.isNotBlank(projectName),"project_name",projectName);
+                .like(StringUtils.isNotBlank(projectName),"project_name",projectName)
+                .like(StringUtils.isNotBlank(projectCode),"project_code",projectCode);
 
         return wrapper;
     }

--
Gitblit v1.9.3