|
@@ -7,7 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<resultMap type="Product" id="ProductResult">
|
|
<resultMap type="Product" id="ProductResult">
|
|
<result property="id" column="id" />
|
|
<result property="id" column="id" />
|
|
<result property="parentId" column="parent_id" />
|
|
<result property="parentId" column="parent_id" />
|
|
- <result property="parentName" column="parent_name" />
|
|
|
|
<result property="name" column="name" />
|
|
<result property="name" column="name" />
|
|
<result property="snsId" column="sns_id" />
|
|
<result property="snsId" column="sns_id" />
|
|
<result property="isDelete" column="is_delete" />
|
|
<result property="isDelete" column="is_delete" />
|
|
@@ -18,15 +17,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectProductVo">
|
|
<sql id="selectProductVo">
|
|
- select id, parent_id,
|
|
|
|
- (select t.name from phm_product t where t.id = parent_id and t.is_delete = 0 limit 1) as parent_name,
|
|
|
|
- name, sns_id, is_delete, create_by, create_time, update_by, update_time from phm_product
|
|
|
|
|
|
+ select id, parent_id, name, sns_id, is_delete, create_by, create_time, update_by, update_time from phm_product
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="selectProductList" parameterType="Product" resultMap="ProductResult">
|
|
<select id="selectProductList" parameterType="Product" resultMap="ProductResult">
|
|
<include refid="selectProductVo"/>
|
|
<include refid="selectProductVo"/>
|
|
<where>
|
|
<where>
|
|
- <if test="parentName != null and parentName != ''"> and parent_name like concat('%', #{parentName}, '%')</if>
|
|
|
|
|
|
+ <if test="parentId != null "> and parent_id = #{parentId}</if>
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
<if test="snsId != null and snsId != ''"> and sns_id = #{snsId}</if>
|
|
<if test="snsId != null and snsId != ''"> and sns_id = #{snsId}</if>
|
|
</where>
|
|
</where>
|
|
@@ -41,7 +38,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
insert into phm_product
|
|
insert into phm_product
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">parent_id,</if>
|
|
<if test="parentId != null">parent_id,</if>
|
|
- <if test="parentName != null">parent_name,</if>
|
|
|
|
<if test="name != null">name,</if>
|
|
<if test="name != null">name,</if>
|
|
<if test="snsId != null">sns_id,</if>
|
|
<if test="snsId != null">sns_id,</if>
|
|
<if test="isDelete != null">is_delete,</if>
|
|
<if test="isDelete != null">is_delete,</if>
|
|
@@ -52,7 +48,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
</trim>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">#{parentId},</if>
|
|
<if test="parentId != null">#{parentId},</if>
|
|
- <if test="parentName != null">#{parentName},</if>
|
|
|
|
<if test="name != null">#{name},</if>
|
|
<if test="name != null">#{name},</if>
|
|
<if test="snsId != null">#{snsId},</if>
|
|
<if test="snsId != null">#{snsId},</if>
|
|
<if test="isDelete != null">#{isDelete},</if>
|
|
<if test="isDelete != null">#{isDelete},</if>
|
|
@@ -67,7 +62,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
update phm_product
|
|
update phm_product
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
- <if test="parentName != null">parent_name = #{parentName},</if>
|
|
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="snsId != null">sns_id = #{snsId},</if>
|
|
<if test="snsId != null">sns_id = #{snsId},</if>
|
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|