GoodsCommentMapper.xml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.mdd.common.mapper.comment.GoodsCommentMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.mdd.common.entity.comment.GoodsComment">
  6. <!-- <id column="id" property="id"/>
  7. <result column="create_id" property="createId"/>
  8. <result column="create_time" property="createTime"/>
  9. <result column="update_id" property="updateId"/>
  10. <result column="update_time" property="updateTime"/>
  11. <result column="company_id" property="companyId"/>
  12. <result column="account_id" property="accountId"/>
  13. <result column="account_chart_id" property="accountChartId"/>
  14. <result column="is_add_next_level" property="isAddNextLevel"/>
  15. <result column="is_reallocate" property="isReallocate"/>
  16. <result column="tenant_id" property="tenantId"/>-->
  17. </resultMap>
  18. <sql id="base_sql">
  19. id,
  20. goods_id,
  21. user_id,
  22. order_goods_id,
  23. service_comment,
  24. comment,
  25. reply,
  26. status,
  27. create_time,
  28. update_time,
  29. delete_time,
  30. comment_level
  31. </sql>
  32. <select id="pageResult" resultType="com.mdd.common.dto.result.GoodsCommentPageResultDto">
  33. select a.id,
  34. a.goods_id as goodsId,
  35. a.user_id as userId,
  36. a.order_goods_id as orderGoodsId,
  37. a.service_comment as serviceComment,
  38. a.comment,
  39. a.reply,
  40. a.status,
  41. a.create_time as createTime,
  42. a.update_time as updateTime,
  43. a.comment_level as commentLevel,
  44. c.avatar as avatarUri,
  45. c.nickname,
  46. c.username,
  47. c.sn,
  48. d.image as goodsImageUri,
  49. d.name as goodsName,
  50. d.price,
  51. e.name as unitName
  52. from la_goods_comment a
  53. left join la_user c on a.user_id = c.id
  54. left join la_goods d on a.goods_id = d.id
  55. left join la_goods_unit e on d.unit_id = e.id
  56. <where>
  57. a.is_delete = 0
  58. <if test="form.goodsId != null">
  59. and a.goods_id = #{form.goodsId}
  60. </if>
  61. <if test="form.commentLevel != null and form.commentLevel != 0 and form.commentLevel != 4">
  62. and a.comment_level = #{form.commentLevel}
  63. </if>
  64. <if test="form.userId != null">
  65. and a.user_id = #{form.userId}
  66. </if>
  67. <if test="form.goodsInfo != null and form.goodsInfo != ''">
  68. and d.name like concat('%', #{form.goodsInfo}, '%')
  69. </if>
  70. <if test="form.status != null">
  71. and a.status = #{form.status}
  72. </if>
  73. <if test="form.userInfo != null and form.userInfo != ''">
  74. and (c.nickname like concat('%', #{form.userInfo}, '%') or
  75. c.mobile like concat('%', #{form.userInfo}, '%'))
  76. </if>
  77. <if test="form.startTime != null">
  78. and a.create_time &gt;= #{form.startTime}
  79. </if>
  80. <if test="form.endTime != null">
  81. and a.create_time &lt;= #{form.endTime}
  82. </if>
  83. </where>
  84. order by a.create_time desc
  85. </select>
  86. </mapper>