ConsumptionTopUpLogMapper.xml 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  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="cn.newfeifan.mall.module.distri.dal.mysql.consumptiontopuplog.ConsumptionTopUpLogMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
  9. -->
  10. <select id="ptTopUpWithUserTopUpList"
  11. resultType="cn.newfeifan.mall.module.distri.controller.admin.integraltopuplog.vo.TopUpRespVO">
  12. SELECT
  13. DATE(combined.date) AS date,
  14. SUM(combined.conut) AS consumptionPoints
  15. FROM (
  16. SELECT
  17. DATE(create_time) AS date,
  18. sum(integral_points) AS conut
  19. FROM distri_integral_top_up_log where deleted = 0 GROUP BY date(create_time)
  20. ) AS combined
  21. GROUP BY DATE(combined.date)
  22. HAVING SUM(combined.conut) > 0
  23. ORDER BY date
  24. </select>
  25. <select id="getTotalConsumptionPoints" resultType="java.lang.Long">
  26. SELECT
  27. SUM(integral_points) total
  28. FROM
  29. distri_integral_top_up_log where deleted = 0
  30. </select>
  31. </mapper>