金币系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
5.0 KiB

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.example.demo.mapper.RefundMapper">
  6. <select id="getRefundA" resultType="com.example.demo.domain.vo.RefundA">
  7. SELECT
  8. CASE
  9. WHEN au.status = 0 THEN '待审核'
  10. WHEN au.status = 1 THEN '已通过'
  11. WHEN au.status = 2 THEN '已驳回'
  12. ELSE '其他状态'
  13. END AS status,
  14. COUNT(*) AS Raudit,
  15. SUM(d.recharge_coin) AS SumRaudit1,
  16. SUM(d.free_coin) AS SumRaudit2,
  17. SUM(d.task_coin) AS SumRaudit3,
  18. (SUM(d.recharge_coin) + SUM(d.free_coin) + SUM(d.task_coin)) AS SumRaudit
  19. FROM
  20. detail d
  21. LEFT JOIN audit au ON d.detail_id = au.refund_id
  22. LEFT JOIN `user` ON d.jwcode = `user`.jwcode
  23. <where>
  24. d.detail_flag = 1
  25. AND d.update_type = 2
  26. <if test="flags != null and flags.size > 0">
  27. and au.status IN
  28. <foreach collection="flags" item="au.status" open="(" separator="," close=")">
  29. #{au.status}
  30. </foreach>
  31. </if>
  32. <if test='jwcode!=null and jwcode.length>0'>and d.jwcode=#{jwcode}</if>
  33. <if test='startDate != null and endDate != null'>AND d.create_time BETWEEN #{startDate} AND #{endDate}</if>
  34. <if test='area!=null and area.length>0'>and user.area=#{area}</if>
  35. <if test='refundType != null and refundType.length>0'>AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')</if>
  36. <if test='refundGoods != null and refundGoods.length>0'>AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')</if>
  37. <if test="areas != null">
  38. AND area IN
  39. <foreach collection="areas" item="areas" open="(" separator="," close=")">
  40. #{areas}
  41. </foreach>
  42. </if>
  43. </where>
  44. GROUP BY
  45. au.status
  46. </select>
  47. <select id="select" resultType="com.example.demo.domain.entity.Detail">
  48. SELECT
  49. d.jwcode,
  50. d.refund_type,
  51. d.refund_goods,
  52. d.recharge_coin,
  53. d.free_coin,
  54. d.task_coin,
  55. d.remark,
  56. d.create_time,
  57. d.detail_id,
  58. u.area,
  59. a.name AS adminName,
  60. u.name AS userName,
  61. au.status,
  62. au.reson AS auditReson,
  63. au.refund_id,
  64. au.audit_id
  65. FROM detail d
  66. LEFT JOIN `admin` a ON d.admin_id = a.admin_id
  67. LEFT JOIN `user` u ON d.jwcode = u.jwcode
  68. LEFT JOIN audit au ON d.detail_id = au.refund_id
  69. <where>
  70. d.detail_flag = 1
  71. AND update_type = 2
  72. <if test='status != null'>
  73. AND au.status = #{status}
  74. </if>
  75. <if test='area != null and area.length > 0'>
  76. AND u.area = #{area}
  77. </if>
  78. <if test='jwcode != null and jwcode.length > 0'>
  79. AND d.jwcode = #{jwcode}
  80. </if>
  81. <if test='refundType != null and refundType.length > 0'>
  82. AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')
  83. </if>
  84. <if test='refundGoods != null and refundGoods.length > 0'>
  85. AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')
  86. </if>
  87. <if test='startDate != null and endDate != null'>
  88. AND d.create_time BETWEEN #{startDate} AND #{endDate}
  89. </if>
  90. <if test="areas != null">
  91. AND u.area IN
  92. <foreach collection="areas" item="areas" open="(" separator="," close=")">
  93. #{areas}
  94. </foreach>
  95. </if>
  96. </where>
  97. <choose>
  98. <when test="sortField != null and sortField.length >0 or sortOrder != null and sortOrder.length >0">
  99. ORDER BY ${sortField} ${sortOrder}
  100. </when>
  101. <otherwise>
  102. ORDER BY d.create_time DESC
  103. </otherwise>
  104. </choose>
  105. </select>
  106. <select id="queryDetailYWithUser" resultType="map">
  107. SELECT
  108. d.detaily_id,
  109. u.name,
  110. d.jwcode,
  111. u.area,
  112. d.consume_platform,
  113. d.update_type,
  114. d.recharge_coin,
  115. d.task_coin,
  116. d.free_coin,
  117. d.create_admin,
  118. d.create_time
  119. FROM
  120. detail_y d
  121. LEFT JOIN
  122. user u ON d.jwcode = u.jwcode
  123. <where>
  124. <if test='updateType != null'>
  125. AND d.update_type = #{updateType}
  126. </if>
  127. <if test='jwcode != null'>
  128. AND d.jwcode = #{jwcode}
  129. </if>
  130. <if test='area != null'>
  131. AND u.area = #{area}
  132. </if>
  133. <if test='startDate != null and endDate != null'>
  134. AND create_time BETWEEN #{startDate} AND #{endDate}
  135. </if>
  136. </where>
  137. ORDER BY
  138. detaily_id DESC
  139. </select>
  140. </mapper>