<?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.com.ctop.kuaishou.modules.app.mapper.KuaishouAccountBalanceBudgetMapper">

    <insert id="replace">
        replace
        into ctop_kuaishou_account_balance_budget
        (
        id,
        account_id ,
        balance ,
        day_budget ,
        day_budget_schedule ,
        state,
        create_time
        )
        values
        (
        #{id},
        #{accountId},
        #{balance},
        #{dayBudget},
        #{dayBudgetSchedule},
        #{state},
        #{createTime}
        )
    </insert>


    <update id="updateAllIsInvalidState">
        update ctop_kuaishou_account_balance_budget
        set state =0
        where 1 = 1
    </update>

    <select id="queryByAccountId" resultType="cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget">
        SELECT *
        FROM ctop_kuaishou_account_balance_budget
        WHERE account_id = #{accountId}
    </select>

</mapper>