From ec24bac9aa1fcd095c5767705fa0a4303aaf2f42 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 27 十一月 2024 19:25:27 +0800
Subject: [PATCH] 项目新增暂提

---
 business/src/main/resources/mapper/ProjectProcessMapper.xml             |    4 ++--
 system/src/main/java/com/ycl/system/domain/base/AbsEntity.java          |    2 +-
 business/src/main/java/com/ycl/domain/entity/File.java                  |    5 ++---
 common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java    |   24 ++++++++++++++++++++++++
 business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java |   12 +++++++++---
 5 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/business/src/main/java/com/ycl/domain/entity/File.java b/business/src/main/java/com/ycl/domain/entity/File.java
index c71fac2..0602ab1 100644
--- a/business/src/main/java/com/ycl/domain/entity/File.java
+++ b/business/src/main/java/com/ycl/domain/entity/File.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.ycl.common.enums.business.FileTypeEnum;
 import com.ycl.system.domain.base.AbsEntity;
 import lombok.Data;
 
@@ -22,8 +23,6 @@
 
     private static final long serialVersionUID = 1L;
 
-    @TableId(value = "id", type = IdType.ASSIGN_ID)
-    private Integer id;
     /**
      * 鏂囦欢璺緞
      */
@@ -35,7 +34,7 @@
     /**
      * 鏂囦欢鍒嗙被
      */
-    private String type;
+    private FileTypeEnum type;
     /**
      * 鏂囦欢鍚�
      */
diff --git a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
index 5c18d4a..7f650e5 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.common.base.Result;
+import com.ycl.common.enums.business.FileTypeEnum;
 import com.ycl.domain.entity.File;
 import com.ycl.domain.entity.ProjectInfo;
 import com.ycl.domain.form.ProjectInfoForm;
@@ -10,6 +11,7 @@
 import com.ycl.domain.vo.*;
 import com.ycl.framework.utils.PageUtil;
 import com.ycl.mapper.ProjectInfoMapper;
+import com.ycl.service.FileService;
 import com.ycl.service.ProjectInfoService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
@@ -34,7 +36,7 @@
 public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements ProjectInfoService {
 
     private final ProjectInfoMapper projectInfoMapper;
-
+    private final FileService fileService;
     /**
      * 娣诲姞
      *
@@ -46,10 +48,14 @@
     public Result add(ProjectInfoForm form) {
         //娣诲姞鍩烘湰淇℃伅
         ProjectInfo entity = ProjectInfoForm.getEntityByForm(form, null);
-//        baseMapper.insert(entity);
+        baseMapper.insert(entity);
         //娣诲姞鏂囦欢
         List<File> fileList = form.getFileList();
-
+        fileList.forEach(item->{
+            item.setBusId(entity.getId());
+            item.setType(FileTypeEnum.PROJECT_INFO);
+        });
+        fileService.saveBatch(fileList);
         return Result.ok("娣诲姞鎴愬姛");
     }
 
diff --git a/business/src/main/resources/mapper/ProjectProcessMapper.xml b/business/src/main/resources/mapper/ProjectProcessMapper.xml
index 9985dee..2e19f42 100644
--- a/business/src/main/resources/mapper/ProjectProcessMapper.xml
+++ b/business/src/main/resources/mapper/ProjectProcessMapper.xml
@@ -14,9 +14,9 @@
         <result column="invest_type" property="investType" />
         <result column="project_phase" property="projectPhase" />
         <result column="tag" property="tag" />
-        <result column="competent_department" property="competentDepartment" />
+<!--        <result column="competent_department" property="competentDepartment" />-->
         <result column="area_code" property="areaCode" />
-        <result column="management_centralization" property="managementCentralization" />
+<!--        <result column="management_centralization" property="managementCentralization" />-->
         <result column="project_approval_type" property="projectApprovalType" />
         <result column="investment_catalogue" property="investmentCatalogue" />
         <result column="importance_type" property="importanceType" />
diff --git a/common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java b/common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java
new file mode 100644
index 0000000..7b5ef08
--- /dev/null
+++ b/common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java
@@ -0,0 +1,24 @@
+package com.ycl.common.enums.business;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+import lombok.Getter;
+
+/**
+ * 鏂囦欢绫诲瀷鏋氫妇
+ *
+ * @author锛歠lq
+ * @date锛�2024/11/27 18:21
+ */
+@Getter
+public enum FileTypeEnum {
+    PROJECT_INFO("project_info", "椤圭洰鍩烘湰淇℃伅");
+
+    private final String code;
+
+    private final String desc;
+
+    FileTypeEnum(String code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+}
diff --git a/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java b/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java
index e2a9f06..3dbfca3 100644
--- a/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java
+++ b/system/src/main/java/com/ycl/system/domain/base/AbsEntity.java
@@ -18,7 +18,7 @@
     private static final long serialVersionUID = 1L;
 
     @TableId(value = "id", type = IdType.ASSIGN_ID)
-    private Integer id;
+    private Long id;
 
     /** 鍒涘缓鏃堕棿 */
     @TableField(value = "gmt_create", fill = FieldFill.INSERT)

--
Gitblit v1.8.0