<?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.kxs.stat.biz.mapper.KxsZlbTradeMapper">

    <resultMap type="com.kxs.stat.api.model.KxsZlbTrade" id="KxsZlbTradeMap">
        <result column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="del_flag" property="delFlag" />
        <result column="version" property="version" />
        <result column="trade_date" property="tradeDate" />
        <result column="trade_month" property="tradeMonth" />
        <result column="user_id" property="userId" />
        <result column="trade_amt" property="tradeAmt" />
        <result column="total_type" property="totalType" />

    </resultMap>
    <select id="getZlbTrade" resultType="com.kxs.stat.api.vo.TotalTradeAmtVO">
        select sum(trade_amt) as zlbAmt from  kxs_zlb_trade
        <where>
            and user_id = #{userId}
            <if test="type == 1">
                and trade_date = #{date}
            </if>
            <if test="type == 2">
                and trade_month = #{date}
            </if>
            and del_flag != 1
            and total_type = #{totalType}
        </where>
    </select>

</mapper>
