<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yami.shop.dao.PointsRechargeMapper">

    <select id="statisticsList" resultType="com.yami.shop.bean.vo.PointsRechargeVO">
        SELECT
        sum(points) AS totalPoints,
        count(id) AS totalUserCount,
        channel_name AS channelName,
        max(create_time) AS createTime
        FROM tz_points_recharge
        <where>
              <if test="channelId != null"> channel_id = #{channelId}</if>
        </where>
        GROUP BY channel_id, channel_name
    </select>
</mapper>
