<?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="cn.reghao.tnb.user.app.db.mapper.WalletChargeMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert into user_wallet_charge
        (`charge_id`,`quantity`,`owner`,`status`)
        values 
        (#{chargeId},#{quantity},#{owner},#{status})
    </insert>

    <update id="updateStatus">
        update user_wallet_charge
        set `status`=#{status}
        where `charge_id`=#{chargeId}
    </update>
    
    <select id="findAll" resultType="cn.reghao.tnb.user.app.model.po.WalletCharge">
        select *
        from user_wallet_charge
        limit 20
    </select>
    <select id="findByStatus" resultType="cn.reghao.tnb.user.api.dto.WalletChargeDto">
        select *
        from user_wallet_charge
        where `status`=#{status}
    </select>
    <select id="findByChargeId" resultType="cn.reghao.tnb.user.app.model.po.WalletCharge">
        select *
        from user_wallet_charge
        where charge_id=#{chargeId}
    </select>
</mapper>
