From 14255942c7a30ddac8f513c91b026ae34e17cfde Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 16 五月 2024 17:55:26 +0800
Subject: [PATCH] 完善代码
---
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 81 +++++++++++++++++++---------------------
1 files changed, 38 insertions(+), 43 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 0cca318..0714a04 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 property="deleted" column="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" />
+ <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,24 +181,19 @@
<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>
+ <select id="selectAll" resultType="com.dy.pmsGlobal.pojoPlt.PltProduct">
+ select
+ <include refid="Base_Column_List" />
+ from plt_product p
+ where p.deleted!=1
+ order by id desc
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0