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.

98 lines
4.1 KiB

4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days 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. from user_gold_record ugr
  11. left join `user` on `user`.jwcode = `ugr`.jwcode
  12. left join `admin` on `admin`.id = `ugr`.admin_id
  13. <where>
  14. <if test="jwcode != null">
  15. and `ugr`.jwcode = #{jwcode}
  16. </if>
  17. <if test="payPlatform != null and payPlatform.length > 0">
  18. and `ugr`.pay_platform = #{payPlatform}
  19. </if>
  20. <if test="type != null">
  21. and `ugr`.type = #{type}
  22. </if>
  23. <if test="market != null and market.length > 0">
  24. and `user`.market = #{market}
  25. </if>
  26. <if test="startTime != null and endTime != null">
  27. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  28. </if>
  29. </where>
  30. <choose>
  31. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  32. ORDER BY ${sortField} ${sortOrder}
  33. </when>
  34. <otherwise>
  35. ORDER BY audit_time DESC
  36. </otherwise>
  37. </choose>
  38. </select>
  39. <select id="getTotal" resultType="com.example.demo.domain.vo.Total">
  40. select sum(sum_gold) as Goldtotal, sum(permanent_gold) as permanentGold, sum(free_june+free_december) as freeGold, sum(task_gold) as taskGold
  41. from user_gold_record
  42. <where>
  43. <if test="jwcode != null">
  44. and `ugr`.jwcode = #{jwcode}
  45. </if>
  46. <if test="payPlatform != null and payPlatform.length > 0">
  47. and `ugr`.pay_platform = #{payPlatform}
  48. </if>
  49. <if test="type != null">
  50. and `ugr`.type = #{type}
  51. </if>
  52. <if test="market != null and market.length > 0">
  53. and `user`.market = #{market}
  54. </if>
  55. <if test="startTime != null and endTime != null">
  56. and ugr.`audit_time` BETWEEN #{startTime} AND #{endTime}
  57. </if>
  58. </where>
  59. </select>
  60. <select id="getGold" resultType="com.example.demo.domain.entity.User">
  61. select * from user
  62. <where>
  63. <if test="jwcode != null">
  64. and jwcode = #{jwcode}
  65. </if>
  66. <if test="market != null and market.length > 0">
  67. and market = #{market}
  68. </if>
  69. </where>
  70. <choose>
  71. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  72. ORDER BY ${sortField} ${sortOrder}
  73. </when>
  74. <otherwise>
  75. ORDER BY create_time DESC
  76. </otherwise>
  77. </choose>
  78. </select>
  79. <select id="GoldTotal" resultType="com.example.demo.domain.vo.Total">
  80. select
  81. sum(current_permanent_gold) as permanentGold,
  82. sum(current_free_june + current_free_december) as freeGold,
  83. sum(current_task_gold) as taskGold,
  84. sum(current_permanent_gold) + sum(current_free_june + current_free_december) + sum(current_task_gold) as Goldtotal
  85. from `user`
  86. <where>
  87. <if test="jwcode != null ">
  88. and jwcode = #{jwcode}
  89. </if>
  90. <if test="market != null and market.length > 0">
  91. and market = #{market}
  92. </if>
  93. </where>
  94. </select>
  95. </mapper>