<?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.cyksj.mapper.ZfbShopOrderDayLimitMapper">

    <update id="decrRemainOrdersById">
        update zfb_shop_order_day_limit set day_remain_orders = day_remain_orders - 1,hour_remain_orders = hour_remain_orders - 1 where id = #{id} and day_remain_orders > 0 and hour_remain_orders > 0
    </update>

    <update id="incrDayLimitRemainOrders">
        update zfb_shop_order_day_limit set day_remain_orders = day_remain_orders + 1 where app_id = #{shopId} and day_remain_orders >= 0 and day_remain_orders &lt; day_limit_orders;
    </update>

    <update id="incrHourLimitRemainOrders">
        update zfb_shop_order_day_limit set hour_remain_orders = hour_remain_orders + 1 where app_id = #{shopId} and hour_remain_orders >= 0 and hour_remain_orders &lt; hour_limit_orders;
    </update>
</mapper>