123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <?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.kmall.admin.dao.CommentDao">
- <resultMap type="com.kmall.admin.entity.CommentEntity" id="commentMap">
- <result property="id" column="id"/>
- <result property="typeId" column="type_id"/>
- <result property="valueId" column="value_id"/>
- <result property="userId" column="user_id"/>
- <result property="orderId" column="order_id"/>
- <result property="productId" column="product_id"/>
- <result property="goodsSpecificationNameValue" column="goods_specification_name_value"/>
- <result property="status" column="status"/>
- <result property="content" column="content"/>
- <result property="addTime" column="add_time"/>
- <result property="evalLevel" column="eval_level"/>
- <result property="deliveryLevel" column="delivery_level"/>
- <result property="goodsLevel" column="goods_level"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.CommentEntity">
- select
- `id`,
- `type_id`,
- `value_id`,
- `user_id`,
- `order_id`,
- `product_id`,
- `goods_specification_name_value`,
- `status`,
- `content`,
- `add_time`,
- `eval_level`,
- `delivery_level`,
- `goods_level`
- from mall_comment
- where id = #{id}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.CommentEntity">
- select
- mall_comment.id,
- mall_comment.type_id,
- mall_comment.value_id,
- mall_comment.user_id,
- mall_comment.order_id,
- mall_comment.product_id,
- mall_comment.goods_specification_name_value,
- mall_comment.status,
- mall_comment.content,
- mall_comment.add_time,
- mall_comment.eval_level,
- mall_comment.delivery_level,
- mall_comment.goods_level,
- mall_user.username user_name,
- mall_goods.name value_name
- from mall_comment LEFT JOIN mall_user ON mall_comment.user_id = mall_user.id
- LEFT JOIN mall_goods ON mall_comment.value_id = mall_goods.id
- left join mall_order o on mall_comment.order_id = o.id
- WHERE 1=1
- <if test="userName != null and userName.trim() != ''">
- AND mall_user.username LIKE concat('%',#{userName},'%')
- </if>
- <if test="valueName != null and valueName.trim() != ''">
- AND mall_goods.name LIKE concat('%',#{valueName},'%')
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="status != null">
- AND mall_comment.status = #{status}
- </if>
- <if test="orderId != null">
- AND mall_comment.order_id = #{orderId}
- </if>
- <if test="picUrl == 'true'">
- AND EXISTS(SELECT 1 FROM mall_comment_picture WHERE mall_comment.id = mall_comment_picture.comment_id)
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by mall_comment.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(*) from mall_comment LEFT JOIN mall_user ON mall_comment.user_id = mall_user.id
- LEFT JOIN mall_goods ON mall_comment.value_id = mall_goods.id
- WHERE 1=1
- <if test="userName != null and userName.trim() != ''">
- AND mall_user.username LIKE concat('%',#{userName},'%')
- </if>
- <if test="valueName != null and valueName.trim() != ''">
- AND mall_goods.name LIKE concat('%',#{valueName},'%')
- </if>
- <if test="status != null">
- AND mall_comment.status = #{status}
- </if>
- <if test="orderId != null">
- AND mall_comment.order_id = #{orderId}
- </if>
- <if test="picUrl == 'true'">
- AND EXISTS(SELECT 1 FROM mall_comment_picture WHERE mall_comment.id = mall_comment_picture.comment_id)
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.CommentEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall_comment(
- `type_id`,
- `value_id`,
- `user_id`,
- `order_id`,
- `product_id`,
- `goods_specification_name_value`,
- `status`,
- `content`,
- `add_time`,
- `eval_level`,
- `delivery_level`,
- `goods_level`)
- values(
- #{typeId},
- #{valueId},
- #{userId},
- #{orderId},
- #{productId},
- #{goodsSpecificationNameValue},
- #{status},
- #{content},
- #{addTime},
- #{evalLevel},
- #{deliveryLevel},
- #{goodsLevel})
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.CommentEntity">
- update mall_comment
- <set>
- <if test="typeId != null">`type_id` = #{typeId}, </if>
- <if test="valueId != null">`value_id` = #{valueId}, </if>
- <if test="userId != null">`user_id` = #{userId}, </if>
- <if test="orderId != null">`order_id` = #{orderId}, </if>
- <if test="productId != null">`product_id` = #{productId}, </if>
- <if test="goodsSpecificationNameValue != null">`goods_specification_name_value` = #{goodsSpecificationNameValue}, </if>
- <if test="status != null">`status` = #{status}, </if>
- <if test="content != null">`content` = #{content}, </if>
- <if test="addTime != null">`add_time` = #{addTime}, </if>
- <if test="evalLevel != null">`eval_level` = #{evalLevel}, </if>
- <if test="deliveryLevel != null">`delivery_level` = #{deliveryLevel}, </if>
- <if test="goodsLevel != null">`goods_level` = #{goodsLevel}</if>
- </set>
- where id = #{id}
- </update>
- <delete id="delete">
- delete from mall_comment where id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall_comment where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|