218 lines
7.9 KiB
XML
218 lines
7.9 KiB
XML
<?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">
|
|
<mapper namespace="com.zhwl.wcsc.mapper.ZdyWcscGoodsCommentMapper">
|
|
|
|
<resultMap type="ZdyWcscGoodsComment" id="ZdyWcscGoodsCommentResult">
|
|
<result property="id" column="id"/>
|
|
<result property="goodsId" column="goods_id"/>
|
|
<result property="orderId" column="order_id"/>
|
|
<result property="orderItemId" column="order_item_id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="level" column="level"/>
|
|
<result property="content" column="content"/>
|
|
<result property="images" column="images"/>
|
|
<result property="status" column="status"/>
|
|
<result property="adminId" column="admin_id"/>
|
|
<result property="replyContent" column="reply_content"/>
|
|
<result property="replytime" column="replytime"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="deletetime" column="deletetime"/>
|
|
<result property="goodName" column="goodName"/>
|
|
<result property="userName" column="userName"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyWcscGoodsCommentVo">
|
|
SELECT com.id,
|
|
com.goods_id,
|
|
com.order_id,
|
|
com.order_item_id,
|
|
com.user_id,
|
|
com.LEVEL,
|
|
com.content,
|
|
com.images,
|
|
com.STATUS,
|
|
com.admin_id,
|
|
com.reply_content,
|
|
com.replytime,
|
|
com.create_time,
|
|
com.update_time,
|
|
com.deletetime,
|
|
go.title AS goodName,
|
|
CASE
|
|
WHEN (u.`name` IS NOT NULL AND u.`name` != '') THEN
|
|
u.`name`
|
|
ELSE u.nickname
|
|
END AS userName
|
|
FROM zdy_wcsc_goods_comment com
|
|
LEFT JOIN zdy_wcsc_goods go ON go.id = com.goods_id
|
|
LEFT JOIN zdy_user u ON u.id = com.user_id
|
|
</sql>
|
|
|
|
<select id="selectZdyWcscGoodsCommentList" parameterType="ZdyWcscGoodsComment"
|
|
resultMap="ZdyWcscGoodsCommentResult">
|
|
<include refid="selectZdyWcscGoodsCommentVo"/>
|
|
<where>
|
|
<if test="goodsId != null ">
|
|
and com.goods_id = #{goodsId}
|
|
</if>
|
|
<if test="orderId != null ">
|
|
and com.order_id = #{orderId}
|
|
</if>
|
|
<if test="orderItemId != null ">
|
|
and com.order_item_id = #{orderItemId}
|
|
</if>
|
|
<if test="userId != null ">
|
|
and com.user_id = #{userId}
|
|
</if>
|
|
<if test="level != null ">
|
|
and com.level = #{level}
|
|
</if>
|
|
<if test="content != null and content != ''">
|
|
and com.content = #{content}
|
|
</if>
|
|
<if test="images != null and images != ''">
|
|
and com.images = #{images}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
and com.status = #{status}
|
|
</if>
|
|
<if test="adminId != null ">
|
|
and com.admin_id = #{adminId}
|
|
</if>
|
|
<if test="replyContent != null and replyContent != ''">
|
|
and com.reply_content = #{replyContent}
|
|
</if>
|
|
<if test="goodName != null and goodName != ''">
|
|
and goo.title like concat('%', #{goodName}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectZdyWcscGoodsCommentById" parameterType="Long"
|
|
resultMap="ZdyWcscGoodsCommentResult">
|
|
<include refid="selectZdyWcscGoodsCommentVo"/>
|
|
where com.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertZdyWcscGoodsComment" parameterType="ZdyWcscGoodsComment" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into zdy_wcsc_goods_comment
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="goodsId != null">goods_id,
|
|
</if>
|
|
<if test="orderId != null">order_id,
|
|
</if>
|
|
<if test="orderItemId != null">order_item_id,
|
|
</if>
|
|
<if test="userId != null">user_id,
|
|
</if>
|
|
<if test="level != null">level,
|
|
</if>
|
|
<if test="content != null">content,
|
|
</if>
|
|
<if test="images != null">images,
|
|
</if>
|
|
<if test="status != null and status != ''">status,
|
|
</if>
|
|
<if test="adminId != null">admin_id,
|
|
</if>
|
|
<if test="replyContent != null">reply_content,
|
|
</if>
|
|
<if test="replytime != null">replytime,
|
|
</if>
|
|
create_time,
|
|
<if test="deletetime != null">deletetime,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="goodsId != null">#{goodsId},
|
|
</if>
|
|
<if test="orderId != null">#{orderId},
|
|
</if>
|
|
<if test="orderItemId != null">#{orderItemId},
|
|
</if>
|
|
<if test="userId != null">#{userId},
|
|
</if>
|
|
<if test="level != null">#{level},
|
|
</if>
|
|
<if test="content != null">#{content},
|
|
</if>
|
|
<if test="images != null">#{images},
|
|
</if>
|
|
<if test="status != null and status != ''">#{status},
|
|
</if>
|
|
<if test="adminId != null">#{adminId},
|
|
</if>
|
|
<if test="replyContent != null">#{replyContent},
|
|
</if>
|
|
<if test="replytime != null">#{replytime},</if>
|
|
sysdate(),
|
|
<if test="deletetime != null">#{deletetime},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyWcscGoodsComment" parameterType="ZdyWcscGoodsComment">
|
|
update zdy_wcsc_goods_comment
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="goodsId != null">goods_id =
|
|
#{goodsId},
|
|
</if>
|
|
<if test="orderId != null">order_id =
|
|
#{orderId},
|
|
</if>
|
|
<if test="orderItemId != null">order_item_id =
|
|
#{orderItemId},
|
|
</if>
|
|
<if test="userId != null">user_id =
|
|
#{userId},
|
|
</if>
|
|
<if test="level != null">level =
|
|
#{level},
|
|
</if>
|
|
<if test="content != null">content =
|
|
#{content},
|
|
</if>
|
|
<if test="images != null">images =
|
|
#{images},
|
|
</if>
|
|
<if test="status != null and status != ''">status =
|
|
#{status},
|
|
</if>
|
|
<if test="adminId != null">admin_id =
|
|
#{adminId},
|
|
</if>
|
|
<if test="replyContent != null">reply_content =
|
|
#{replyContent},
|
|
</if>
|
|
<if test="replytime != null">replytime = #{replytime},</if>
|
|
update_time = sysdate(),
|
|
<if test="deletetime != null">deletetime = #{deletetime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteZdyWcscGoodsCommentById" parameterType="Long">
|
|
delete
|
|
from zdy_wcsc_goods_comment
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyWcscGoodsCommentByIds" parameterType="String">
|
|
delete from zdy_wcsc_goods_comment where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectZdyWcscGoodsCommentByItemId" parameterType="Long"
|
|
resultMap="ZdyWcscGoodsCommentResult">
|
|
<include refid="selectZdyWcscGoodsCommentVo"/>
|
|
where com.order_item_id = #{orderItemId}
|
|
</select>
|
|
|
|
</mapper>
|