103 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			XML
		
	
			
		
		
	
	
			103 lines
		
	
	
		
			4.2 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.hcy.common.mapper.comment.GoodsCommentMapper">
 | |
|     <!-- 通用查询映射结果 -->
 | |
|     <resultMap id="BaseResultMap" type="com.hcy.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.hcy.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,
 | |
|                a.staff_id        as staffId,
 | |
|                a.customer_service_appraise as customerServiceAppraise,
 | |
|                c.avatar          as avatarUri,
 | |
|                c.nickname,
 | |
|                c.username,
 | |
|                c.sn,
 | |
|                c.mobile          as userMobile,
 | |
|                d.image           as goodsImageUri,
 | |
|                d.name            as goodsName,
 | |
|                d.price,
 | |
|                e.name            as unitName,
 | |
|                s.sn              as staffSn,
 | |
|                s.name            as staffName
 | |
|         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
 | |
|                      left join la_staff as s on s.id = a.staff_id
 | |
|         <where>
 | |
|             a.is_delete = 0
 | |
|             <if test="form.flag != null and form.flag == 1">
 | |
|                 and a.service_comment is not null
 | |
|             </if>
 | |
|             <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>
 | |
|             <if test="form.staffInfo != null and form.staffInfo != ''">
 | |
|                 and s.sn like concat('%', #{form.staffInfo}, '%') or
 | |
|                 s.name like concat('%', #{form.staffInfo}, '%') or
 | |
|                 s.mobile like concat('%', #{form.staffInfo}, '%')
 | |
|             </if>
 | |
|         </where>
 | |
|         order by a.create_time desc
 | |
|     </select>
 | |
| </mapper>
 |