<?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.xy.mapper.MercFeeCountDayMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.xy.entity.MercFeeCountDay">
        <id column="id" property="id"/>
        <result column="merc_id" property="mercId"/>
        <result column="device_id" property="deviceId"/>
        <result column="date_value" property="dateValue"/>
        <result column="pay_money" property="payMoney"/>
        <result column="brokerage" property="brokerage"/>
        <result column="fee_type" property="feeType"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <select id="countByMonth" resultType="com.xy.dto.MercFeeCountDayDto$CountByMonthVO">
        SELECT parent_merc_id,
               merc_id,
               fee_type,
               SUM(pay_money) AS pay_money,
               SUM(brokerage) AS brokerage
        FROM merc_fee_count_day
        WHERE month_value = #{query.monthValue}
        GROUP BY parent_merc_id,
                 merc_id,
                 fee_type
    </select>
</mapper>




