WithdrawRecordMapper.xml 3.3 KB
<?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.sibu.orderHelper.integral.dao.WithdrawRecordDao">

    <resultMap type="com.sibu.orderHelper.integral.reponse.WithdrawRecordResponse" id="withdrawRecordResponse">
        <id column="id" property="id" />
        <result column="member_id" property="memberId" />
        <result column="partner_trade_no" property="partnerTradeNo" />
        <result column="open_id" property="openId" />
        <result column="amount" property="amount" />
        <result column="user_name" property="userName" />
        <result column="pay_desc" property="payDesc" />
        <result column="pay_dt" property="payDt" />
        <result column="create_dt" property="createDt" />
        <result column="status" property="status" />
        <result column="fail_code" property="failCode" />
        <result column="operator" property="operator" />
    </resultMap>

    <resultMap type="com.sibu.orderHelper.integral.reponse.WithdrawRecordDetailResponse" id="withdrawRecordDetailResponse">
        <result column="amount" property="amount" />
        <result column="wechat" property="wechat" />
        <collection property="statusTimeLine" column="id" ofType="com.sibu.orderHelper.integral.reponse.WithDrawRecodeDetailTimeLineResponse">
            <result column="status" property="status" />
        </collection>
    </resultMap>

    <!--查询已提现金额-->
    <select id="selectHasWithdrawSum" parameterType="java.util.Map" resultType="java.math.BigDecimal">
        select sum(amount) from t_withdraw_record where status in(1,2) and member_id=#{memberId}
    </select>

    <!--添加申请提现记录-->
    <insert id="insertWithdrawRecord" useGeneratedKeys="true" keyProperty="id" parameterType="com.sibu.orderHelper.integral.model.AddWithdrawRecord">
        insert into t_withdraw_record(member_id,partner_trade_no,open_id,amount,user_name,wechat)
        VALUE(
        #{memberId},
        #{partnerTradeNo},
        #{openId},
        #{amount},
        #{userName},
        #{wechat}
        )
    </insert>

    <!--添加申请提现详情进度记录-->
    <insert id="insertWithdrawRecordDetail" parameterType="com.sibu.orderHelper.integral.model.AddWithDrawDetailBean">
        insert into t_withdraw_record_status(withdraw_recode_id,status,create_dt)
        VALUE(
        #{withdrawRecodeId},
        #{status},
        NOW()
        )
    </insert>

    <!--分页查询提现记录-->
    <select id="selectHasWithdrawForPage" parameterType="java.util.Map" resultMap="withdrawRecordResponse">
        select * from  t_withdraw_record where member_id=#{memberId} limit #{pageNow},#{pageSize}
    </select>

    <!--查询提现记录详情-->
    <select id="selectWithdrawDetail" parameterType="java.util.Map" resultMap="withdrawRecordDetailResponse">
        select ts.status,t.amount,t.wechat from t_withdraw_record_status ts,t_withdraw_record t where ts.withdraw_recode_id=#{withdrawRecordId} AND t.id=ts.withdraw_recode_id ORDER BY ts.create_dt DESC
    </select>

    <!--查询总记录条数-->
    <select id="selectCountWithdraw"  parameterType="java.util.Map" resultType="java.lang.Integer">
        select count(1) from t_withdraw_record where member_id=#{memberId}
    </select>
</mapper>