金币系统后端
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.

130 lines
6.6 KiB

5 months ago
5 months ago
5 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
3 months ago
5 months ago
3 months ago
5 months ago
  1. package com.example.demo.mapper;
  2. import com.example.demo.domain.entity.DetailY;
  3. import com.example.demo.domain.entity.UserDetailExport;
  4. import com.example.demo.domain.vo.DetailYgold;
  5. import com.example.demo.domain.vo.DetailExport;
  6. import org.apache.ibatis.annotations.*;
  7. import java.util.List;
  8. @Mapper
  9. public interface DetailYMapper {
  10. @Insert({
  11. // "insert into detail_y",
  12. // "(jwcode,order_code,activity_id,recharge_way,product_id,consume_platform,consume_type,refund_type,refund_goods,name,username,area" +
  13. // "contact_id,remark,recharge_coin,free_coin,task_coin,admin_id,update_type,detail_flag,create_time,first_recharge)",
  14. // "values ",
  15. // "(#{jwcode},#{orderCode},#{activityId},#{rechargeWay},#{productId},#{consumePlatform},#{consumeType},#{refundType}" +
  16. // ",#{refundGoods},#{name},#{username},#{area},#{contactId},#{remark},#{rechargeCoin}" +
  17. // ",#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now(),#{firstRecharge})"
  18. "insert into detail_y \n" +
  19. "(jwcode, order_code, activity_id, recharge_way, product_id, consume_platform, consume_type, refund_type, refund_goods, name, username, area, contact_id, remark, recharge_coin, free_coin, task_coin, admin_id, update_type, detail_flag, create_time, first_recharge,product_name)\n" +
  20. "values \n" +
  21. "(#{jwcode}, #{orderCode}, #{activityId}, #{rechargeWay}, #{productId}, #{consumePlatform}, #{consumeType}, #{refundType}, #{refundGoods},'小洪', #{username}, #{area}, #{contactId}, #{remark}, #{rechargeCoin}, #{freeCoin}, #{taskCoin}, #{adminId}, #{updateType}, 1, #{createTime}, #{firstRecharge},#{productName})"
  22. })
  23. @Options(useGeneratedKeys = true,keyColumn = "detaily_id",keyProperty = "detailyId")
  24. int add(DetailY detaily);
  25. @Select({
  26. "SELECT * from detail_y where detaily_id =#{detailyId}"
  27. })
  28. DetailY selectByDetailyId(Integer detaily_id);
  29. @Select({
  30. "<script>",
  31. "SELECT ",
  32. "`user`.name,`user`.area,user_gold.buy_jb,user_gold.core_jb,user_gold.free_12,user_gold.free_6,",
  33. "user_gold.jwcode,",
  34. "SUM(CASE WHEN detail_y.update_type = 0 THEN detail_y.recharge_coin ELSE 0 END) AS Rcoin,",
  35. "SUM(CASE WHEN detail_y.update_type = 1 THEN detail_y.recharge_coin + detail_y.free_coin + detail_y.task_coin ELSE 0 END) AS Scoin",
  36. "FROM ",
  37. "detail_y",
  38. "LEFT JOIN ",
  39. "user_gold ON detail_y.jwcode = user_gold.jwcode",
  40. "LEFT JOIN",
  41. "`user` ON detail_y.jwcode = `user`.jwcode",
  42. "<where>",
  43. "<if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode=#{jwcode}</if>",
  44. "<if test='area!=null and area.length>0'>AND `user`.area=#{area}</if>",
  45. "</where>",
  46. "GROUP BY",
  47. "user_gold.jwcode",
  48. "ORDER BY ",
  49. "Rcoin DESC",
  50. "</script>"
  51. })
  52. List<DetailYgold> selectgold(DetailYgold detailYgold);
  53. @Select({
  54. "<script>",
  55. "select username,name,detail_y.jwcode,area,detail_y.update_type,detail_y.create_time,detail_y.consume_platform,detail_y.free_coin,detail_y.recharge_coin,detail_y.task_coin from detail_y",
  56. // "select * from detail_y",
  57. // "select detail_y.*,admin.name,admin.area,user.name as uname,audit.status from detail",
  58. // "left join `admin` on `detail_y`.admin_id = `admin`.admin_id",
  59. // "left join `user` on `detail_y`.jwcode = `user`.jwcode",
  60. // "left join audit on `detail_y`.detail_id=audit.detail_id",
  61. "<where>",
  62. // "(status is null or status='1')",
  63. "<if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode=#{jwcode}</if>",
  64. "<if test='updateType!=null'>and update_type=#{updateType}</if>",
  65. "<if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>",
  66. "<if test='consumePlatform!=null and consumePlatform.length>0'>and consume_platform=#{consumePlatform}</if>",
  67. "<if test='area!=null and area.length>0'>and area=#{area}</if>",
  68. "</where>",
  69. "ORDER BY detaily_id desc",
  70. "</script>"
  71. })
  72. List<DetailY> select(DetailY detailY);
  73. @Select({
  74. "<script>",
  75. "SELECT",
  76. " SUM(`recharge_coin`) AS 'sumR',",
  77. " SUM(`task_coin`) AS 'sumT',",
  78. " SUM(`free_coin`) AS 'sumF'",
  79. "FROM",
  80. "`detail_y`",
  81. "<where>",
  82. "<if test='jwcode!=null and jwcode.length>0'>AND jwcode=#{jwcode}</if>",
  83. "<if test='updateType!=null'>AND update_type=#{updateType}</if>",
  84. "<if test='startDate != null and endDate != null'>AND create_time BETWEEN #{startDate} AND #{endDate}</if>",
  85. "<if test='area!=null and area.length>0'>AND area=#{area}</if>",
  86. "</where>",
  87. "</script>"
  88. })
  89. DetailY getCount(DetailY detailY);
  90. //导出数据的SQL
  91. @Select({
  92. "<script>",
  93. "SELECT d.detaily_id,u.name,d.jwcode,u.area,d.consume_platform,d.update_type,d.recharge_coin,d.task_coin," +
  94. "d.free_coin,d.create_admin,d.create_time",
  95. "FROM detail_y d",
  96. "LEFT JOIN user u on d.jwcode = u.jwcode ",
  97. "ORDER BY detaily_id LIMIT #{offset}, #{pageSize}",
  98. "</script>"
  99. })
  100. List<UserDetailExport> searchExport(@Param("offset") int offset, @Param("pageSize") int pageSize);
  101. @Select("SELECT COUNT(*) FROM detail_y")
  102. int getTotalCount();
  103. @Select({
  104. "<script>",
  105. "SELECT d.detaily_id,u.name,d.jwcode,u.area,d.consume_platform,d.update_type,d.recharge_coin,d.task_coin," +
  106. "d.free_coin,d.create_admin,d.create_time",
  107. "FROM detail_y d",
  108. "LEFT JOIN user u on d.jwcode = u.jwcode ",
  109. "<where>",
  110. "<if test='updateType!=null'>AND d.update_type=#{updateType}</if>",
  111. "<if test='jwcode!=null'>AND d.jwcode=#{jwcode}</if>",
  112. "<if test='area != null '>AND u.area=#{area}</if>",
  113. "<if test='startDate != null and endDate != null'>AND create_time BETWEEN #{startDate} AND #{endDate}</if>",
  114. "</where>",
  115. "ORDER BY detaily_id desc",
  116. "</script>"
  117. })
  118. List<UserDetailExport> searchAll(DetailExport detailExport);
  119. }