12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?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.chelvc.cloud.vehicle.server.dao.CommentMapper">
- <resultMap id="SIMPLE_COMMENT_RESULT_MAP" type="com.chelvc.cloud.vehicle.api.dto.CommentDTO">
- <id column="id" property="id" jdbcType="BIGINT"/>
- <result column="user_id" property="userId" jdbcType="BIGINT"/>
- <result column="score" property="score" jdbcType="DOUBLE"/>
- <result column="content" property="content" jdbcType="VARCHAR"/>
- <result column="attachments" property="attachments" jdbcType="VARCHAR"
- typeHandler="com.chelvc.framework.database.handler.FilesTypeHandler"/>
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
- </resultMap>
- <select id="listGoodsComments" resultMap="SIMPLE_COMMENT_RESULT_MAP">
- select id, user_id, score, content, attachments, create_time
- from `comment`
- <where>
- goods_id = #{goodsId}
- <if test="param.offset != null">
- and id > #{param.offset}
- </if>
- </where>
- order by create_time desc limit #{param.size}
- </select>
- <select id="getGoodsComments" resultMap="SIMPLE_COMMENT_RESULT_MAP">
- select id, user_id, score, content, attachments, create_time
- from `comment`
- <where>
- parent_id = #{parentId}
- <if test="goodsId != null">
- and goods_id = #{goodsId}
- </if>
- <if test="merchantId != null">
- and merchant_id = #{merchantId}
- </if>
- <if test="param.offset != null">
- and id > #{param.offset}
- </if>
- </where>
- order by create_time desc limit #{param.size}
- </select>
- </mapper>
|