From fd3819392c0c3fafc4f1d7d254b952207ddca3b5 Mon Sep 17 00:00:00 2001
From: liuxm <liuxm_a@163.com>
Date: 星期四, 23 五月 2024 10:56:39 +0800
Subject: [PATCH] 产品文件相关修改
---
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java | 19 +++------
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java | 13 +-----
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java | 14 -------
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java | 2 -
pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml | 15 ++-----
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 16 +-------
6 files changed, 15 insertions(+), 64 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
index 2674de4..80195e5 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
@@ -8,8 +8,6 @@
int deleteByPrimaryKey(Long id);
- int insert(PltProductFile record);
-
int insertSelective(PltProductFile record);
PltProductFile selectByPrimaryKey(Long id);
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
index df63134..3d9f6de 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
@@ -85,17 +85,8 @@
@NotNull(message = "鎶�鏈弬鏁颁笉鑳戒负绌�")
public List<PltProductParams> params;
- /**
- * 鏂囦欢绫诲瀷:01:宸ヨ壓鏂囦欢,02:鐢ㄦ埛鎵嬪唽,03:鐗╂枡娓呭崟
- */
- @NotNull(message = "宸ヨ壓鏂囦欢涓嶈兘涓虹┖")
- public List<PltProductFile> processDocuments;
-
- @NotNull(message = "鐢ㄦ埛鎵嬪唽涓嶈兘涓虹┖")
- public List<PltProductFile> userManual;
-
- @NotNull(message = "鐗╂枡娓呭崟涓嶈兘涓虹┖")
- public List<PltProductFile> materials;
+ @NotNull(message = "浜у搧鏂囦欢涓嶈兘涓虹┖")
+ public List<PltProductFile> proFiles;
}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
index 229e846..be4744b 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
@@ -27,17 +27,10 @@
delete from plt_product_file
where id = #{id,jdbcType=BIGINT}
</delete>
- <delete id="deleteByProId">
- delete from plt_product_file
- where pro_id = #{proId,jdbcType=BIGINT}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
- insert into plt_product_file
- ( id,pro_id,file_id
- ,file_type)
- values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{fileId,jdbcType=BIGINT}
- ,#{fileType,jdbcType=VARCHAR})
- </insert>
+ <delete id="deleteByProId">
+ delete from plt_product_file
+ where pro_id = #{proId,jdbcType=BIGINT}
+ </delete>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
insert into plt_product_file
<trim prefix="(" suffix=")" suffixOverrides=",">
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
index 5c5f0f6..07d8341 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -18,9 +18,7 @@
<resultMap id="BaseResultMap2" type="com.dy.pmsGlobal.pojoPlt.PltProduct" extends="BaseResultMap">
<collection property="params" ofType="com.dy.pmsGlobal.pojoPlt.PltProductParams" fetchType="eager" select="selectParams" column="id" />
- <collection property="processDocuments" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectDocuments" column="id"/>
- <collection property="userManual" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectUserManual" column="id" />
- <collection property="materials" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectMaterials" column="id"/>
+ <collection property="proFiles" ofType="com.dy.pmsGlobal.pojoPlt.PltProductFile" fetchType="eager" select="selectDocuments" column="id"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
@@ -37,17 +35,7 @@
<select id="selectDocuments" resultMap="com.dy.pmsGlobal.daoPlt.PltProductFileMapper.BaseResultMap">
select *
from plt_product_file
- where pro_id = #{proId,jdbcType=BIGINT} and file_type = '01'
- </select>
- <select id="selectUserManual" resultMap="com.dy.pmsGlobal.daoPlt.PltProductFileMapper.BaseResultMap">
- select *
- from plt_product_file
- where pro_id = #{proId,jdbcType=BIGINT} and file_type = '02'
- </select>
- <select id="selectMaterials" resultMap="com.dy.pmsGlobal.daoPlt.PltProductFileMapper.BaseResultMap">
- select *
- from plt_product_file
- where pro_id = #{proId,jdbcType=BIGINT} and file_type = '03'
+ where pro_id = #{proId,jdbcType=BIGINT}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap2">
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
index 48ca437..4b54650 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
@@ -1,7 +1,6 @@
package com.dy.pmsPlatform.product;
import com.alibaba.excel.converters.Converter;
-import com.alibaba.fastjson2.JSON;
import com.dy.common.aop.SsoPowerAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
@@ -14,26 +13,13 @@
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ByteArrayResource;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.core.io.Resource;
-import org.springframework.http.ContentDisposition;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.StreamUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
/**
* 浜у搧绠$悊
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
index 52970e2..86a72d0 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -123,16 +123,15 @@
paramDao.insert(param);
}
});
- saveRel(p, p.processDocuments, "01");
- saveRel(p, p.userManual, "02");
- saveRel(p, p.materials, "03");
+ saveRel(p, p.proFiles);
}
- private void saveRel(PltProduct p, List<PltProductFile> docs, String fileType) {
+ private void saveRel(PltProduct p, List<PltProductFile> docs) {
docs.forEach(doc -> {
- doc.proId = p.id;
- doc.fileType = fileType;
- pfDao.insert(doc);
+ if(doc.id == null){
+ doc.proId = p.id;
+ pfDao.insertSelective(doc);
+ }
});
}
@@ -162,11 +161,7 @@
pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl);
}
- Stream.concat(
- pro.userManual.stream(),
- Stream.concat(pro.processDocuments.stream(), pro.materials.stream())
- )
- .forEach(doc -> {
+ pro.proFiles.stream().forEach(doc -> {
OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId);
FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
--
Gitblit v1.8.0