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.

152 lines
6.5 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  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.example.demo.mapper.coin.GoldDetailMapper">
  4. <insert id="insertExportRecord" useGeneratedKeys="true" keyProperty="recordId.id">
  5. insert into export (account,type,state,url,file_name,data_num)
  6. values(#{account},#{type},#{state},#{url},#{fileName},#{dataNum})
  7. </insert>
  8. <select id="getGoldDetail" resultType="com.example.demo.domain.vo.coin.GoldDetail">
  9. select `user`.name, `user`.jwcode, m.name as market, `ugr`.pay_platform, `ugr`.type, `ugr`.sum_gold, `ugr`.permanent_gold, `ugr`.free_june, `ugr`.free_december, `ugr`.task_gold, `admin`.admin_name, `ugr`.audit_time,
  10. `ugr`.free_june+`ugr`.free_december as free_gold
  11. from user_gold_record ugr
  12. left join `user` on `user`.jwcode = `ugr`.jwcode
  13. left join `admin` on `admin`.id = `ugr`.admin_id
  14. left join market m on m.id=`user`.market
  15. <where>
  16. ugr.flag = 1 and
  17. ugr.audit_status IN (1,3)
  18. <if test="jwcode != null">
  19. and ugr.jwcode = #{jwcode}
  20. </if>
  21. <if test="payPlatform != null and payPlatform.length > 0">
  22. and ugr.pay_platform = #{payPlatform}
  23. </if>
  24. <if test="type != null">
  25. and `ugr`.type = #{type}
  26. </if>
  27. <if test="markets!= null and markets.size > 0">
  28. AND user.market IN
  29. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  30. #{markets}
  31. </foreach>
  32. </if>
  33. <if test="startTime != null and endTime != null">
  34. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  35. </if>
  36. </where>
  37. <choose>
  38. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  39. ORDER BY ${sortField} ${sortOrder}
  40. </when>
  41. <otherwise>
  42. ORDER BY audit_time DESC
  43. </otherwise>
  44. </choose>
  45. </select>
  46. <select id="getTotal" resultType="com.example.demo.domain.vo.coin.Total">
  47. select sum(sum_gold) as Goldtotal, sum(permanent_gold) as permanentGold, sum(free_june+free_december) as freeGold, sum(task_gold) as taskGold
  48. from user_gold_record ugr
  49. <where>
  50. ugr.flag = 1 and
  51. ugr.audit_status IN (1,3)
  52. <if test="jwcode != null">
  53. and `ugr`.jwcode = #{jwcode}
  54. </if>
  55. <if test="payPlatform != null and payPlatform.length > 0">
  56. and `ugr`.pay_platform = #{payPlatform}
  57. </if>
  58. <if test="type != null">
  59. and `ugr`.type = #{type}
  60. </if>
  61. <if test="markets!= null and markets.size > 0">
  62. AND user.market IN
  63. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  64. #{market}
  65. </foreach>
  66. </if>
  67. <if test="startTime != null and endTime != null">
  68. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  69. </if>
  70. </where>
  71. </select>
  72. <select id="getGold" resultType="com.example.demo.domain.entity.User">
  73. select * from user
  74. <where>
  75. <if test="jwcode != null">
  76. and jwcode = #{jwcode}
  77. </if>
  78. <if test="markets != null and markets.size > 0">
  79. AND user.market IN
  80. <foreach collection="markets" item="market" open="(" separator="," close=")">
  81. #{market}
  82. </foreach>
  83. </if>
  84. </where>
  85. <choose>
  86. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  87. ORDER BY ${sortField} ${sortOrder}
  88. </when>
  89. <otherwise>
  90. ORDER BY create_time DESC
  91. </otherwise>
  92. </choose>
  93. </select>
  94. <select id="GoldTotal" resultType="com.example.demo.domain.vo.coin.Total">
  95. select
  96. sum(current_permanent_gold) as permanentGold,
  97. sum(current_free_june + current_free_december) as freeGold,
  98. sum(current_task_gold) as taskGold,
  99. sum(current_permanent_gold) + sum(current_free_june + current_free_december) + sum(current_task_gold) as Goldtotal
  100. from `user`
  101. <where>
  102. <if test="jwcode != null ">
  103. and jwcode = #{jwcode}
  104. </if>
  105. <if test="markets!= null and markets.size > 0">
  106. AND user.market IN
  107. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  108. #{markets}
  109. </foreach>
  110. </if>
  111. </where>
  112. </select>
  113. <select id="getGoldDetail1" resultType="com.example.demo.domain.vo.coin.GoldDetail">
  114. select `user`.name, `user`.jwcode, `user`.market, `ugr`.pay_platform, `ugr`.type, `ugr`.sum_gold, `ugr`.permanent_gold, `ugr`.free_june, `ugr`.free_december, `ugr`.task_gold, `admin`.admin_name, `ugr`.audit_time
  115. from user_gold_record ugr
  116. left join `user` on `user`.jwcode = `ugr`.jwcode
  117. left join `admin` on `admin`.id = `ugr`.admin_id
  118. <where>
  119. ugr.flag = 1
  120. <if test="jwcode != null">
  121. and `ugr`.jwcode = #{jwcode}
  122. </if>
  123. <if test="payPlatform != null and payPlatform.length > 0">
  124. and `ugr`.pay_platform = #{payPlatform}
  125. </if>
  126. <if test="type != null">
  127. and `ugr`.type = #{type}
  128. </if>
  129. <if test="markets != null">
  130. AND user.market IN
  131. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  132. #{markets}
  133. </foreach>
  134. </if>
  135. <if test="startTime != null and endTime != null">
  136. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  137. </if>
  138. </where>
  139. <choose>
  140. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  141. ORDER BY ${sortField} ${sortOrder}
  142. </when>
  143. <otherwise>
  144. ORDER BY audit_time DESC
  145. </otherwise>
  146. </choose>
  147. </select>
  148. </mapper>