12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?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.mdd.common.mapper.comment.GoodsCommentMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.mdd.common.entity.comment.GoodsComment">
- <!-- <id column="id" property="id"/>
- <result column="create_id" property="createId"/>
- <result column="create_time" property="createTime"/>
- <result column="update_id" property="updateId"/>
- <result column="update_time" property="updateTime"/>
- <result column="company_id" property="companyId"/>
- <result column="account_id" property="accountId"/>
- <result column="account_chart_id" property="accountChartId"/>
- <result column="is_add_next_level" property="isAddNextLevel"/>
- <result column="is_reallocate" property="isReallocate"/>
- <result column="tenant_id" property="tenantId"/>-->
- </resultMap>
- <sql id="base_sql">
- id,
- goods_id,
- user_id,
- order_goods_id,
- service_comment,
- comment,
- reply,
- status,
- create_time,
- update_time,
- delete_time,
- comment_level
- </sql>
- <select id="pageResult" resultType="com.mdd.common.dto.result.GoodsCommentPageResultDto">
- select a.id,
- a.goods_id as goodsId,
- a.user_id as userId,
- a.order_goods_id as orderGoodsId,
- a.service_comment as serviceComment,
- a.comment,
- a.reply,
- a.status,
- a.create_time as createTime,
- a.update_time as updateTime,
- a.comment_level as commentLevel,
- c.avatar as avatarUri,
- c.nickname,
- c.username,
- c.sn,
- d.image as goodsImageUri,
- d.name as goodsName,
- d.price,
- e.name as unitName
- from la_goods_comment a
- left join la_user c on a.user_id = c.id
- left join la_goods d on a.goods_id = d.id
- left join la_goods_unit e on d.unit_id = e.id
- <where>
- a.is_delete = 0
- <if test="form.goodsId != null">
- and a.goods_id = #{form.goodsId}
- </if>
- <if test="form.commentLevel != null and form.commentLevel != 0 and form.commentLevel != 4">
- and a.comment_level = #{form.commentLevel}
- </if>
- <if test="form.userId != null">
- and a.user_id = #{form.userId}
- </if>
- <if test="form.goodsInfo != null and form.goodsInfo != ''">
- and d.name like concat('%', #{form.goodsInfo}, '%')
- </if>
- <if test="form.status != null">
- and a.status = #{form.status}
- </if>
- <if test="form.userInfo != null and form.userInfo != ''">
- and (c.nickname like concat('%', #{form.userInfo}, '%') or
- c.mobile like concat('%', #{form.userInfo}, '%'))
- </if>
- <if test="form.startTime != null">
- and a.create_time >= #{form.startTime}
- </if>
- <if test="form.endTime != null">
- and a.create_time <= #{form.endTime}
- </if>
- </where>
- order by a.create_time desc
- </select>
- </mapper>
|