From abc305426c16e7ea9d21c12c41356c18ddb1adef Mon Sep 17 00:00:00 2001
From: liuxm <liuxm@fescotech.com>
Date: 星期二, 14 五月 2024 16:29:58 +0800
Subject: [PATCH] 产品管理功能,组合了工艺文件,用户手册,物料清单,技术参数

---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java     |    2 
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java   |   84 ++++++++++-
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java    |   10 -
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java          |   22 ++
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java |   14 -
 pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml                |   30 ---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java |    6 
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java      |   30 +++-
 pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml              |  142 ++++++++++---------
 pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml                  |   71 ++++------
 10 files changed, 231 insertions(+), 180 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 4ab9b22..2674de4 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
@@ -5,6 +5,7 @@
 
 @Mapper
 public interface PltProductFileMapper {
+
     int deleteByPrimaryKey(Long id);
 
     int insert(PltProductFile record);
@@ -16,4 +17,7 @@
     int updateByPrimaryKeySelective(PltProductFile record);
 
     int updateByPrimaryKey(PltProductFile record);
-}
\ No newline at end of file
+
+    void deleteByProId(Long proId);
+
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
index 955d898..baa61eb 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
@@ -8,8 +8,6 @@
 
 @Mapper
 public interface PltProductMapper {
-    int deleteByPrimaryKey(Long id);
-
     int insert(PltProduct record);
 
     int insertSelective(PltProduct record);
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 296f51e..92c6ffb 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
@@ -7,9 +7,11 @@
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
 import lombok.*;
 
 import java.util.Date;
+import java.util.List;
 
 @TableName(value="plt_product", autoResultMap = true)
 @Data
@@ -50,10 +52,7 @@
     /**
     * 鎶�鏈礋璐d汉
     */
-    public Long director;
-
-    @TableField(exist = false)
-    public String directorName;
+    public String director;
 
     /**
     * 鎶�鏈礋璐d汉鎵嬫満鍙�
@@ -73,5 +72,20 @@
     */
     public String remark;
 
+    @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;
+
 
 }
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java
index 5a60fa6..e913451 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java
@@ -1,14 +1,16 @@
 package com.dy.pmsGlobal.pojoPlt;
 
-import com.alibaba.fastjson2.annotation.JSONField;
-import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
 import lombok.*;
 
 /**
  * 浜у搧鏂囦欢鍏宠仈琛�
+ * @TableName plt_product_file
  */
 @TableName(value="plt_product_file", autoResultMap = true)
 @Data
@@ -16,19 +18,29 @@
 @ToString
 @NoArgsConstructor
 @AllArgsConstructor
-public class PltProductFile {
+public class PltProductFile implements Serializable {
     /**
-     * 涓婚敭
+     * 
      */
-    public Long id;
+    @TableId(type = IdType.AUTO)
+    private Long id;
 
     /**
-    * 浜у搧瀹炰綋缂栧彿
-    */
+     * 浜у搧瀹炰綋缂栧彿
+     */
     public Long proId;
 
     /**
-    * 鏂囦欢缂栧彿
-    */
+     * 鏂囦欢缂栧彿
+     */
     public Long fileId;
+
+    /**
+     * 鏂囦欢绫诲瀷:01:宸ヨ壓鏂囦欢,02:鐢ㄦ埛鎵嬪唽,03:鐗╂枡娓呭崟
+     */
+    public String fileType;
+
+    @TableField(exist = false)
+    public String webUrl;
+
 }
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
index b9d29f8..57957ec 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java
@@ -39,16 +39,6 @@
     @NotEmpty(message = "鎶�鏈弬鏁板�间笉鑳戒负绌�")
     public String paramValue;
 
-    /**
-    * 瀹夎鎵嬪唽缃戞枃
-    */
-    public Long installManual;
-
-    /**
-    * 鐢ㄦ埛鎵嬪唽缃戞枃
-    */
-    public Long userManual;
-
     @JSONField(serialize = false)
     public Boolean deleted;
 }
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml
index 967f35f..47743cb 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml
@@ -8,13 +8,11 @@
     <result column="pro_id" jdbcType="BIGINT" property="proId" />
     <result column="param_name" jdbcType="VARCHAR" property="paramName" />
     <result column="param_value" jdbcType="VARCHAR" property="paramValue" />
-    <result column="install_manual" jdbcType="BIGINT" property="installManual" />
-    <result column="user_manual" jdbcType="BIGINT" property="userManual" />
     <result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, pro_id, param_name, param_value, install_manual, user_manual,deleted
+    id, pro_id, param_name, param_value, deleted
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -31,10 +29,10 @@
   <insert id="insert" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductParams">
     <!--@mbg.generated-->
     insert into plt_product_params (id, pro_id, param_name,
-      param_value, install_manual, user_manual,deleted
+      param_value, deleted
       )
     values (#{id,jdbcType=BIGINT}, #{proId,jdbcType=BIGINT}, #{paramName,jdbcType=VARCHAR}, 
-      #{paramValue,jdbcType=VARCHAR}, #{installManual,jdbcType=BIGINT}, #{userManual,jdbcType=BIGINT},#{deleted,jdbcType=TINYINT}
+      #{paramValue,jdbcType=VARCHAR}, #{deleted,jdbcType=TINYINT}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductParams">
@@ -53,12 +51,6 @@
       <if test="paramValue != null">
         param_value,
       </if>
-      <if test="installManual != null">
-        install_manual,
-      </if>
-      <if test="userManual != null">
-        user_manual,
-      </if>
       <if test="deleted != null">
         deleted
       </if>
@@ -75,12 +67,6 @@
       </if>
       <if test="paramValue != null">
         #{paramValue,jdbcType=VARCHAR},
-      </if>
-      <if test="installManual != null">
-        #{installManual,jdbcType=BIGINT},
-      </if>
-      <if test="userManual != null">
-        #{userManual,jdbcType=BIGINT},
       </if>
       <if test="deleted != null">
         #{deleted,jdbcType=TINYINT}
@@ -100,12 +86,6 @@
       <if test="paramValue != null">
         param_value = #{paramValue,jdbcType=VARCHAR},
       </if>
-      <if test="installManual != null">
-        install_manual = #{installManual,jdbcType=BIGINT},
-      </if>
-      <if test="userManual != null">
-        user_manual = #{userManual,jdbcType=BIGINT},
-      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -114,9 +94,7 @@
     update plt_product_params
     set pro_id = #{proId,jdbcType=BIGINT},
       param_name = #{paramName,jdbcType=VARCHAR},
-      param_value = #{paramValue,jdbcType=VARCHAR},
-      install_manual = #{installManual,jdbcType=BIGINT},
-      user_manual = #{userManual,jdbcType=BIGINT}
+      param_value = #{paramValue,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
 
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 ebdfbf9..229e846 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
@@ -1,72 +1,80 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dy.pmsGlobal.daoPlt.PltProductFileMapper">
-  <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductFile">
-    <!--@mbg.generated-->
-    <!--@Table plt_product_file-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="pro_id" jdbcType="BIGINT" property="proId" />
-    <result column="file_id" jdbcType="BIGINT" property="fileId" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, pro_id, file_id
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    <!--@mbg.generated-->
-    select 
-    <include refid="Base_Column_List" />
-    from plt_product_file
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
+
+    <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPlt.PltProductFile">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="proId" column="pro_id" jdbcType="BIGINT"/>
+            <result property="fileId" column="file_id" jdbcType="BIGINT"/>
+            <result property="fileType" column="file_type" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,pro_id,file_id,
+        file_type
+    </sql>
+
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from plt_product_file
+        where  id = #{id,jdbcType=BIGINT} 
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        delete from plt_product_file
+        where  id = #{id,jdbcType=BIGINT} 
+    </delete>
+  <delete id="deleteByProId">
     delete from plt_product_file
-    where id = #{id,jdbcType=BIGINT}
+    where  pro_id = #{proId,jdbcType=BIGINT}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
-    <!--@mbg.generated-->
-    insert into plt_product_file (pro_id, file_id)
-    values (#{proId,jdbcType=BIGINT}, #{fileId,jdbcType=BIGINT})
-  </insert>
-  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
-    <!--@mbg.generated-->
-    insert into plt_product_file
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="proId != null">
-        pro_id,
-      </if>
-      <if test="fileId != null">
-        file_id,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="proId != null">
-        #{proId,jdbcType=BIGINT},
-      </if>
-      <if test="fileId != null">
-        #{fileId,jdbcType=BIGINT},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile">
-    <!--@mbg.generated-->
-    update plt_product_file
-    <set>
-      <if test="proId != null">
-        pro_id = #{proId,jdbcType=BIGINT},
-      </if>
-      <if test="fileId != null">
-        file_id = #{fileId,jdbcType=BIGINT},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile">
-    <!--@mbg.generated-->
-    update plt_product_file
-    set pro_id = #{proId,jdbcType=BIGINT},
-      file_id = #{fileId,jdbcType=BIGINT}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-</mapper>
\ No newline at end of file
+        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>
+    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile" useGeneratedKeys="true">
+        insert into plt_product_file
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="id != null">id,</if>
+                <if test="proId != null">pro_id,</if>
+                <if test="fileId != null">file_id,</if>
+                <if test="fileType != null">file_type,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                <if test="id != null">#{id,jdbcType=BIGINT},</if>
+                <if test="proId != null">#{proId,jdbcType=BIGINT},</if>
+                <if test="fileId != null">#{fileId,jdbcType=BIGINT},</if>
+                <if test="fileType != null">#{fileType,jdbcType=VARCHAR},</if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile">
+        update plt_product_file
+        <set>
+                <if test="proId != null">
+                    pro_id = #{proId,jdbcType=BIGINT},
+                </if>
+                <if test="fileId != null">
+                    file_id = #{fileId,jdbcType=BIGINT},
+                </if>
+                <if test="fileType != null">
+                    file_type = #{fileType,jdbcType=VARCHAR},
+                </if>
+        </set>
+        where   id = #{id,jdbcType=BIGINT} 
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductFile">
+        update plt_product_file
+        set 
+            pro_id =  #{proId,jdbcType=BIGINT},
+            file_id =  #{fileId,jdbcType=BIGINT},
+            file_type =  #{fileType,jdbcType=VARCHAR}
+        where   id = #{id,jdbcType=BIGINT} 
+    </update>
+
+</mapper>
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 eb9dff3..acf91ce 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -8,18 +8,41 @@
     <result column="name" jdbcType="VARCHAR" property="name" />
     <result column="type" jdbcType="VARCHAR" property="type" />
     <result column="image" jdbcType="BIGINT" property="image" />
-    <result column="director" jdbcType="BIGINT" property="director" />
+    <result column="director" jdbcType="VARCHAR" property="director" />
     <result column="d_mobile" jdbcType="VARCHAR" property="dMobile" />
     <result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
     <result column="dt" jdbcType="TIMESTAMP" property="dt" />
     <result column="remark" jdbcType="VARCHAR" property="remark" />
-    <association property="directorName" column="director" javaType="java.lang.Long"
-                 select="selectNameById" fetchType="eager" />
+    <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"/>
   </resultMap>
+
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
     id, `name`, `type`, image, director, d_mobile,deleted, dt, remark
   </sql>
+  <select id="selectParams" resultMap="com.dy.pmsGlobal.daoPlt.PltProParamsMapper.BaseResultMap">
+    select *
+    from plt_product_params
+    where pro_id = #{proId,jdbcType=BIGINT} and deleted !=1
+  </select>
+  <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'
+  </select>
 
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -28,15 +51,7 @@
     from plt_product
     where id = #{id,jdbcType=BIGINT}
   </select>
-  <select id="selectNameById" parameterType="java.lang.Long" resultType="java.lang.String">
-    select name directorName from ba_user where id=#{id}
-  </select>
 
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from plt_product
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProduct" useGeneratedKeys="true">
     <!--@mbg.generated-->
     insert into plt_product (`name`, `type`, image,
@@ -147,27 +162,12 @@
   </sql>
   <select id="selectSome" resultMap="BaseResultMap">
     select
-    <include refid="Join_Column_List" >
-      <property name="alias" value="p"/>
-    </include>
+    <include refid="Base_Column_List" />
     from plt_product p
-    left join ba_user u on u.id=p.director
-    where p.deleted!=1 and u.deleted!=1
+    where p.deleted!=1
     <trim prefix="and " suffixOverrides="and">
       <if test="type != null and type != ''">
         p.type = #{type,jdbcType=VARCHAR} and
-      </if>
-      <if test="name != null and name != ''">
-        p.name like concat('%', #{name}, '%') and
-      </if>
-      <if test="director != null  and director != '' ">
-        u.name like concat('%', #{director}, '%') and
-      </if>
-      <if test="dMobile != null and dMobile != '' ">
-        p.d_mobile =#{dMobile,jdbcType=VARCHAR} and
-      </if>
-      <if test="dt != null and dt != '' ">
-        DATE_FORMAT(p.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP}
       </if>
     </trim>
     order by id desc
@@ -181,23 +181,10 @@
   <select id="selectSomeCount" resultType="java.lang.Long">
     select count(1)
     from plt_product p
-    left join ba_user u on u.id=p.director
-    where p.deleted!=1 and u.deleted!=1
+    where p.deleted!=1
     <trim prefix="and " suffixOverrides="and">
       <if test="type != null and type != ''">
         p.type = #{type,jdbcType=VARCHAR} and
-      </if>
-      <if test="name != null and name != ''">
-        u.name like concat('%', #{name}, '%') and
-      </if>
-      <if test="director != null  and director != '' ">
-        p.director like concat('%', #{director}, '%') and
-      </if>
-      <if test="dMobile != null and dMobile != '' ">
-        p.d_mobile =#{dMobile,jdbcType=VARCHAR} and
-      </if>
-      <if test="dt != null and dt != '' ">
-        DATE_FORMAT(p.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP}
       </if>
     </trim>
   </select>
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 66ceacc..f2e651e 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
@@ -6,15 +6,10 @@
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pmsGlobal.aop.Log;
-import com.dy.pmsGlobal.daoOth.OthFileMapper;
-import com.dy.pmsGlobal.dyFile.FileOperate;
-import com.dy.pmsGlobal.dyFile.FileRestVo;
-import com.dy.pmsGlobal.pojoOth.OthFile;
 import com.dy.pmsGlobal.pojoPlt.PltProduct;
 import jakarta.validation.Valid;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 
@@ -48,20 +43,21 @@
     @PostMapping(path="save")
     @SsoPowerAop(power = "10300001")
     @Log("淇濆瓨浜у搧淇℃伅")
-    public BaseResponse<PltProduct> save(@RequestBody @Valid PltProduct pro, BindingResult bindingResult){
+    public BaseResponse<PltProduct> save(@RequestBody @Valid PltProduct pro,
+                                         BindingResult bindingResult){
         pro.id = null;
-        Long id;
+        int count;
         try {
             if (bindingResult != null && bindingResult.hasErrors()) {
                 return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
             }
             pro.setDeleted(false);
-            id = proSv.save(pro);
+            count = proSv.save(pro);
         }catch (Exception e){
             log.error("淇濆瓨浜у搧寮傚父", e);
             return BaseResponseUtils.buildException(e.getMessage());
         }
-        if (id <= 0) {
+        if (count <= 0) {
             return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
         } else {
             return BaseResponseUtils.buildSuccess(true);
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 7ca53a1..55d1449 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
@@ -2,8 +2,10 @@
 
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pmsGlobal.daoOth.OthFileMapper;
+import com.dy.pmsGlobal.daoPlt.PltProParamsMapper;
 import com.dy.pmsGlobal.daoPlt.PltProductFileMapper;
 import com.dy.pmsGlobal.daoPlt.PltProductMapper;
+import com.dy.pmsGlobal.daoPlt.PltProductQualityInspectionItemsMapper;
 import com.dy.pmsGlobal.dyFile.FileOperate;
 import com.dy.pmsGlobal.dyFile.FileRestVo;
 import com.dy.pmsGlobal.pojoOth.OthFile;
@@ -18,6 +20,7 @@
 
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Stream;
 
 @Slf4j
 @Service
@@ -27,6 +30,8 @@
 
     private FileOperate fileOperate;
     private OthFileMapper othFileMapper;
+    private PltProductQualityInspectionItemsMapper itemDao;
+    private PltProParamsMapper paramDao;
 
     @Value("${dy.webFile.fmUrl}")
     private String fmUrl ;
@@ -48,15 +53,57 @@
     public void setPfDao(PltProductFileMapper pfDao) {
         this.pfDao = pfDao;
     }
+    @Autowired
+    public void setItemDao(PltProductQualityInspectionItemsMapper itemDao) {
+        this.itemDao = itemDao;
+    }
+    @Autowired
+    public void setParamDao(PltProParamsMapper paramDao) {
+        this.paramDao = paramDao;
+    }
+
 
     @Transactional
-    public long save(PltProduct p) {
-        return dao.insert(p);
+    public int save(PltProduct p) {
+        int count = dao.insert(p);
+        if(count>0){
+            saveProRel(p);
+        }
+        return count;
     }
     @Transactional
     public int update(PltProduct p) {
-        return dao.updateByPrimaryKeySelective(p);
+        int count = dao.updateByPrimaryKeySelective(p);
+        //鍒犻櫎鏃ф暟鎹�,閲嶆柊鎻掑叆
+        pfDao.deleteByProId(p.id);
+        saveProRel(p);
+        return count;
     }
+
+
+    private void saveProRel(PltProduct p) {
+        p.params.forEach(param->{
+            param.proId=p.id;
+            if(param.id !=null){
+                paramDao.updateByPrimaryKeySelective(param);
+            }else{
+                paramDao.insert(param);
+            }
+        });
+        saveRel(p, p.processDocuments, "01");
+        saveRel(p, p.userManual, "02");
+        saveRel(p, p.materials, "03");
+    }
+
+    private void saveRel(PltProduct p, List<PltProductFile> docs, String fileType) {
+        docs.forEach(doc -> {
+            doc.proId = p.id;
+            doc.fileType = fileType;
+            pfDao.insert(doc);
+        });
+    }
+
+
 
     /**
      * 閫昏緫鍒犻櫎瀹炰綋
@@ -74,16 +121,32 @@
         return pro;
     }
 
-    private PltProduct addWebUrl(PltProduct pro){
-        if(pro !=null &&pro.image!=null){
-            OthFile file = othFileMapper.selectByPrimaryKey(pro.image);
-            FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash );
+    private PltProduct addWebUrl(PltProduct pro) {
+        if (pro != null) {
+            if (pro.image != null) {
+                String filePathWithWebUrl = getFilePathWithWebUrl(pro.image);
+                pro.imageWebPath = filePathWithWebUrl;
+                pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl);
+            }
 
-            pro.imageWebPath=fileRestVo.fileWebUrl +file.filePath;
-            pro.imageWebPathZip= fileOperate.getImgFileZipPath(fileRestVo.fileWebUrl +file.filePath);
+            Stream.concat(
+                     pro.userManual.stream(),
+                     Stream.concat(pro.processDocuments.stream(), pro.materials.stream())
+             )
+             .forEach(doc -> {
+                 String webUrl = getFilePathWithWebUrl(doc.fileId);
+                 doc.webUrl = webUrl;
+             });
         }
         return pro;
     }
+
+    private String getFilePathWithWebUrl(Long fileId) {
+        OthFile file = othFileMapper.selectByPrimaryKey(fileId);
+        FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
+        return fileRestVo.fileWebUrl + file.filePath;
+    }
+
 
     /**
      * 鑾峰彇浜у搧鍒楄〃
@@ -106,10 +169,11 @@
      * @param fileId 鏂囨。id
      * @return 鏇存柊鏁伴噺
      */
-    public int addDoc(long proId,long fileId){
+    public int addDoc(long proId,long fileId,String fileType){
         PltProductFile pf=new PltProductFile();
         pf.fileId = fileId;
         pf.proId = proId;
+        pf.fileType = fileType;
         return pfDao.insertSelective(pf);
     }
 

--
Gitblit v1.8.0