<?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.KxsLkbActTradeMapper">

    <resultMap type="com.kxs.stat.api.model.KxsLkbActTrade" id="KxsLkbActTradeMap">
        <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="user_id" property="userId" />
        <result column="trade_date" property="tradeDate" />
        <result column="act_num" property="actNum" />
        <result column="trade_month" property="tradeMonth" />
        <result column="total_type" property="totalType" />

    </resultMap>
    <select id="getActivityStatByLkbList" resultType="com.kxs.stat.api.vo.statUser.TrendTimesVO">
        select
        sum(act_num) as total, trade_date as `time`
        from
        kxs_lkb_act_trade
        where
        del_flag != 1
        and total_type = #{totalType}
        and user_id = #{userId}
        and trade_date in
        <foreach collection="times" item="time" open="(" separator="," close=")">
            #{time}
        </foreach>
        group by
        `time`
    </select>
    <select id="getActivityStatByLkb" resultType="java.lang.Integer">
        select
        sum(act_num)
        from
        kxs_lkb_act_trade
        where
        del_flag != 1
        and total_type = 0
        and user_id = #{userId}
        and trade_date in
        <foreach collection="times" item="time" open="(" separator="," close=")">
            #{time}
        </foreach>
    </select>

</mapper>
