<?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.yd.dal.mapper.commission.CommissionMapper">
    <resultMap id="base_result_map" type="com.yd.dal.entity.commission.Commission">
 
        <result column="login" property="login"/>
        <result column="name" property="name"/>

        <result column="referral_amount" property="premium"/>
   
        <result column="incomeYearmonth" property="incomeYearmonth"/>
 
    </resultMap>
    <select id="queryCommissionByLogin" parameterType="java.lang.String" resultMap="base_result_map">
		SELECT 
			c.login,		
			c.name,
			sum(f.referral_amount) AS referral_amount,
			f.order_date as incomeYearmonth
		FROM 
		ag_acl_customer c INNER JOIN ag_acl_customer_fortune f
		on c.id = f.customer_id
		WHERE c.login = #{login}
    </select>
</mapper>