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.

136 lines
5.7 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.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.GoldDetail">
  9. 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,
  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. <where>
  15. ugr.flag = 1 and
  16. ugr.audit_status IN (1,3)
  17. <if test="jwcode != null">
  18. and ugr.jwcode = #{jwcode}
  19. </if>
  20. <if test="payPlatform != null and payPlatform.length > 0">
  21. and ugr.pay_platform = #{payPlatform}
  22. </if>
  23. <if test="type != null">
  24. and `ugr`.type = #{type}
  25. </if>
  26. <if test="market != null and market.length > 0">
  27. and `user`.market = #{market}
  28. </if>
  29. <if test="startTime != null and endTime != null">
  30. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  31. </if>
  32. </where>
  33. <choose>
  34. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  35. ORDER BY ${sortField} ${sortOrder}
  36. </when>
  37. <otherwise>
  38. ORDER BY audit_time DESC
  39. </otherwise>
  40. </choose>
  41. </select>
  42. <select id="getTotal" resultType="com.example.demo.domain.vo.Total">
  43. select sum(sum_gold) as Goldtotal, sum(permanent_gold) as permanentGold, sum(free_june+free_december) as freeGold, sum(task_gold) as taskGold
  44. from user_gold_record ugr
  45. <where>
  46. ugr.flag = 1 and
  47. ugr.audit_status IN (1,3)
  48. <if test="jwcode != null">
  49. and `ugr`.jwcode = #{jwcode}
  50. </if>
  51. <if test="payPlatform != null and payPlatform.length > 0">
  52. and `ugr`.pay_platform = #{payPlatform}
  53. </if>
  54. <if test="type != null">
  55. and `ugr`.type = #{type}
  56. </if>
  57. <if test="market != null and market.length > 0">
  58. and `user`.market = #{market}
  59. </if>
  60. <if test="startTime != null and endTime != null">
  61. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  62. </if>
  63. </where>
  64. </select>
  65. <select id="getGold" resultType="com.example.demo.domain.entity.User">
  66. select * from user
  67. <where>
  68. <if test="jwcode != null">
  69. and jwcode = #{jwcode}
  70. </if>
  71. <if test="market != null and market.length > 0">
  72. and market = #{market}
  73. </if>
  74. </where>
  75. <choose>
  76. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  77. ORDER BY ${sortField} ${sortOrder}
  78. </when>
  79. <otherwise>
  80. ORDER BY create_time DESC
  81. </otherwise>
  82. </choose>
  83. </select>
  84. <select id="GoldTotal" resultType="com.example.demo.domain.vo.Total">
  85. select
  86. sum(current_permanent_gold) as permanentGold,
  87. sum(current_free_june + current_free_december) as freeGold,
  88. sum(current_task_gold) as taskGold,
  89. sum(current_permanent_gold) + sum(current_free_june + current_free_december) + sum(current_task_gold) as Goldtotal
  90. from `user`
  91. <where>
  92. <if test="jwcode != null ">
  93. and jwcode = #{jwcode}
  94. </if>
  95. <if test="market != null and market.length > 0">
  96. and market = #{market}
  97. </if>
  98. </where>
  99. </select>
  100. <select id="getGoldDetail1" resultType="com.example.demo.domain.vo.GoldDetail">
  101. 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
  102. from user_gold_record ugr
  103. left join `user` on `user`.jwcode = `ugr`.jwcode
  104. left join `admin` on `admin`.id = `ugr`.admin_id
  105. <where>
  106. ugr.flag = 1
  107. <if test="jwcode != null">
  108. and `ugr`.jwcode = #{jwcode}
  109. </if>
  110. <if test="payPlatform != null and payPlatform.length > 0">
  111. and `ugr`.pay_platform = #{payPlatform}
  112. </if>
  113. <if test="type != null">
  114. and `ugr`.type = #{type}
  115. </if>
  116. <if test="market != null and market.length > 0">
  117. and `user`.market = #{market}
  118. </if>
  119. <if test="startTime != null and endTime != null">
  120. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  121. </if>
  122. </where>
  123. <choose>
  124. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  125. ORDER BY ${sortField} ${sortOrder}
  126. </when>
  127. <otherwise>
  128. ORDER BY audit_time DESC
  129. </otherwise>
  130. </choose>
  131. </select>
  132. </mapper>