<?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.sckw.payment.dao.KwpWalletTransferMapper">
    <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpWalletTransfer">
        <!--@mbg.generated-->
        <!--@Table kwp_wallet_transfer-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
        <result column="uid" jdbcType="VARCHAR" property="uid"/>
        <result column="from_ent" jdbcType="BIGINT" property="fromEnt"/>
        <result column="filter" jdbcType="VARCHAR" property="filter"/>
        <result column="to_ent" jdbcType="BIGINT" property="toEnt"/>
        <result column="channel" jdbcType="VARCHAR" property="channel"/>
        <result column="money" jdbcType="DECIMAL" property="money"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id,
        order_no,
        `uid`,
        from_ent,
        `filter`,
        to_ent,
        channel,
        money,
        remark,
        create_by,
        create_time,
        update_by,
        update_time,
        del_flag,
        `status`
    </sql>

    <select id="pageList" resultMap="BaseResultMap">
        select *
        from kwp_wallet_transfer kwt
        <where>
            kwt.del_flag = 0
            <if test="moneyPage.channel != null and moneyPage.channel != ''">
                and kwt.channel = #{moneyPage.channel,jdbcType=VARCHAR}
            </if>
            <if test="moneyPage.uid != null and moneyPage.uid != ''">
                and kwt.uid = #{moneyPage.uid,jdbcType=VARCHAR}
            </if>
            <if test="moneyPage.filter != null and moneyPage.filter != ''">
                and kwt.filter = #{moneyPage.filter,jdbcType=VARCHAR}
            </if>
        </where>
    </select>
    <select id="sumMoney" resultType="java.math.BigDecimal">
        select ifnull(sum(kwt.money), 0)
        from kwp_wallet_transfer kwt
        <where>
            kwt.del_flag = 0
              and kwt.status = 2
            <if test="fundVo.channel != null and fundVo.channel != ''">
                and kwt.channel = #{fundVo.channel,jdbcType=VARCHAR}
            </if>
            <if test="fundVo.uid != null and fundVo.uid != ''">
                and kwt.uid = #{fundVo.uid,jdbcType=VARCHAR}
            </if>
            <if test="fundVo.filter != null and fundVo.filter != ''">
                and kwt.filter = #{fundVo.filter,jdbcType=VARCHAR}
            </if>
        </where>
    </select>
</mapper>