LifeAppealManageMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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="shop.alien.mapper.LifeAppealManageMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="shop.alien.entity.store.EssentialHolidayComparison">
  6. <id column="id" property="id" />
  7. <result column="festival_name" property="festivalName" />
  8. <result column="festival_date" property="festivalDate" />
  9. <result column="particular_year" property="particularYear" />
  10. </resultMap>
  11. <!-- 通用查询结果列 -->
  12. <sql id="Base_Column_List">
  13. id, festival_name, festival_date, particular_year
  14. </sql>
  15. <!-- 业务类型取自 store_comment.business_type;store_info 无 business_type 列(经营种类为 business_types / business_type_name 等) -->
  16. <select id="getAppealManagement" resultType="shop.alien.entity.store.vo.LifeAppealManageVo">
  17. SELECT
  18. appeal.id,
  19. appeal.store_id,
  20. store.store_name,
  21. su.`name` AS store_contact,
  22. lu.user_phone AS user_phone,
  23. lu.user_name AS user_name,
  24. store.store_tel AS store_phone,
  25. `comment`.content AS customer_report,
  26. appeal.appeal_reason,
  27. appeal.appeal_status AS appeal_type,
  28. si.img_url as appeal_image,
  29. CASE
  30. appeal.appeal_status
  31. WHEN 0 THEN
  32. "待处理"
  33. WHEN 1 THEN
  34. "成功"
  35. WHEN 2 THEN
  36. "失败"
  37. END AS appeal_type_name,
  38. `comment`.source_type AS sourceType,
  39. CASE
  40. `comment`.source_type
  41. WHEN 1 THEN
  42. "动态的评论"
  43. WHEN 2 THEN
  44. "动态社区评论"
  45. WHEN 3 THEN
  46. "打卡评论"
  47. END AS sourceTypeName,
  48. lu.user_phone AS userPhone,
  49. appeal.created_time AS appealTime,
  50. appeal.updated_time AS auditTime,
  51. store.business_section AS businessType,
  52. store.business_type_name AS businessTypeName
  53. FROM
  54. store_comment_appeal appeal
  55. LEFT JOIN store_info store ON appeal.store_id = store.id
  56. LEFT JOIN store_user su ON su.store_id = store.id and su.delete_flag = 0
  57. LEFT JOIN common_comment `comment` ON `comment`.id = appeal.comment_id
  58. LEFT JOIN life_user lu ON `comment`.user_id = lu.id
  59. LEFT JOIN store_img si ON appeal.img_id = si.id
  60. WHERE
  61. 1 = 1
  62. <if test="storeName != null and storeName != ''">
  63. AND store.store_name LIKE CONCAT('%', #{storeName}, '%')
  64. </if>
  65. <if test="storeContact != null and storeContact != ''">
  66. AND `comment`.content LIKE CONCAT('%', #{storeContact}, '%')
  67. </if>
  68. <if test="storePhone != null and storePhone != ''">
  69. AND store.store_tel LIKE CONCAT('%', #{storePhone}, '%')
  70. </if>
  71. <if test="appealType != null and appealType != ''">
  72. AND appeal.appeal_status = #{appealType}
  73. </if>
  74. ORDER BY
  75. appeal.created_time DESC
  76. </select>
  77. <!-- 与 getAppealManagement 同字段,按评论申诉主键查单条,供平台端详情 -->
  78. <select id="getAppealDetailById" resultType="shop.alien.entity.store.vo.LifeAppealManageVo">
  79. SELECT
  80. appeal.id,
  81. appeal.store_id,
  82. store.store_name,
  83. su.`name` AS store_contact,
  84. lu.user_phone AS user_phone,
  85. store.store_tel AS store_phone,
  86. `comment`.content AS customer_report,
  87. appeal.appeal_reason,
  88. appeal.appeal_status AS appeal_type,
  89. si.img_url as appeal_image,
  90. CASE
  91. appeal.appeal_status
  92. WHEN 0 THEN
  93. "待处理"
  94. WHEN 1 THEN
  95. "成功"
  96. WHEN 2 THEN
  97. "失败"
  98. END AS appeal_type_name,
  99. `comment`.source_type,
  100. CASE
  101. `comment`.source_type
  102. WHEN 1 THEN
  103. "动态的评论"
  104. WHEN 2 THEN
  105. "动态社区评论"
  106. WHEN 3 THEN
  107. "打卡评论"
  108. END AS source_type_name,
  109. appeal.created_time AS appeal_time,
  110. appeal.updated_time AS auditTime,
  111. lu.user_phone AS userPhone,
  112. store.business_section AS businessType,
  113. store.business_type_name AS businessTypeName
  114. FROM
  115. store_comment_appeal appeal
  116. LEFT JOIN store_info store ON appeal.store_id = store.id
  117. LEFT JOIN store_user su ON su.store_id = store.id and su.delete_flag = 0
  118. LEFT JOIN common_comment `comment` ON `comment`.id = appeal.comment_id
  119. LEFT JOIN life_user lu ON `comment`.user_id = lu.id
  120. LEFT JOIN store_img si ON appeal.img_id = si.id
  121. WHERE
  122. appeal.id = #{id}
  123. LIMIT 1
  124. </select>
  125. </mapper>