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

76 lines
3.3 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.ConsumeMapper">
  6. <select id="getSumConsume" resultType="com.example.demo.domain.vo.SumConsume">
  7. SELECT
  8. sum(free_coin) as SumFcion,
  9. sum(task_coin) as SumTcion,
  10. sum(recharge_coin) as SumRcion,
  11. sum(recharge_coin+free_coin+task_coin) as Sumcion
  12. from detail_y
  13. <where>
  14. update_type = '1'
  15. <if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode =#{jwcode}</if>
  16. <if test='productName!=null and productName.length>0'>and detail_y.product_name = #{productName}</if>
  17. <if test='consumePlatform!=null and consumePlatform.length>0'>and detail_y.consume_platform=#{consumePlatform}</if>
  18. <if test='consumeType!=null and consumeType.length>0'>and detail_y.consume_type= #{consumeType}</if>
  19. <if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>
  20. <if test='area!=null and area.length>0'>and area=#{area}</if>
  21. <if test="areas != null">
  22. AND area IN
  23. <foreach collection="areas" item="areas" open="(" separator="," close=")">
  24. #{areas}
  25. </foreach>
  26. </if>
  27. </where>
  28. </select>
  29. <select id="select" resultType="com.example.demo.domain.vo.ConsumeDetail">
  30. SELECT
  31. detail_y.*,
  32. admin.name AS adminName
  33. FROM detail_y
  34. LEFT JOIN `admin` ON detail_y.admin_id = admin.admin_id
  35. LEFT JOIN `user` ON detail_y.jwcode = user.jwcode
  36. <where>
  37. update_type = 1
  38. <if test='jwcode != null'>
  39. AND detail_y.jwcode = #{jwcode}
  40. </if>
  41. <if test='productName != null and productName.length > 0'>
  42. AND detail_y.product_name = #{productName}
  43. </if>
  44. <if test='consumePlatform != null and consumePlatform.length > 0'>
  45. AND detail_y.consume_platform = #{consumePlatform}
  46. </if>
  47. <if test='consumeType != null and consumeType.length > 0'>
  48. AND detail_y.consume_type = #{consumeType}
  49. </if>
  50. <if test='startDate != null and endDate != null'>
  51. AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}
  52. </if>
  53. <if test='area != null and area.length > 0'>
  54. AND area = #{area}
  55. </if>
  56. <if test="areas != null">
  57. AND area IN
  58. <foreach collection="areas" item="areas" open="(" separator="," close=")">
  59. #{areas}
  60. </foreach>
  61. </if>
  62. </where>
  63. <choose>
  64. <when test="sortField != null and sortField.length >0 or sortOrder != null and sortOrder.length >0">
  65. ORDER BY ${sortField} ${sortOrder}
  66. </when>
  67. <otherwise>
  68. ORDER BY detail_y.create_time DESC
  69. </otherwise>
  70. </choose>
  71. </select>
  72. <select id="getConsume" resultType="java.lang.String">
  73. SELECT DISTINCT consume_type FROM detail_y where update_type = 1
  74. </select>
  75. </mapper>