liuxm
2024-05-14 abc305426c16e7ea9d21c12c41356c18ddb1adef
产品管理功能,组合了工艺文件,用户手册,物料清单,技术参数
10个文件已修改
411 ■■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductFile.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductParams.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml 142 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
}
    void deleteByProId(Long proId);
}
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);
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 @@
    /**
    * 技术负责人
    */
    public Long director;
    @TableField(exist = false)
    public String directorName;
    public String director;
    /**
    * 技术负责人手机号
@@ -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;
}
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;
}
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;
}
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>
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>
        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>
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>
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);
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);
    }