PointsRechargeMapper.xml 1.1 KB

123456789101112131415161718192021222324
  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.yami.shop.dao.PointsRechargeMapper">
  4. <select id="statisticsList" resultType="com.yami.shop.bean.vo.PointsRechargeVO">
  5. SELECT
  6. sum(points) AS totalPoints,
  7. count(id) AS totalUserCount,
  8. channel_name AS channelName,
  9. max(create_time) AS createTime
  10. FROM tz_points_recharge
  11. <where>
  12. <if test="pointsRecharge.channelId != null"> channel_id = #{pointsRecharge.channelId}</if>
  13. <if test="pointsRecharge.channelIdList != null and !pointsRecharge.channelIdList.isEmpty()">
  14. and channel_id in
  15. <foreach collection="pointsRecharge.channelIdList" item="channelId" open="(" close=")" separator=",">
  16. #{channelId}
  17. </foreach>
  18. </if>
  19. </where>
  20. GROUP BY channel_id, channel_name
  21. ORDER BY max(create_time) DESC
  22. </select>
  23. </mapper>