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/resources/mapper/PltProductMapper.xml |   71 ++++++++++++++---------------------
 1 files changed, 29 insertions(+), 42 deletions(-)

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>

--
Gitblit v1.8.0