<?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.freemud.manager.dao.PushMccafeOrderDao">

    <sql id="all_column">
         id,
         order_code as orderCode,
         partner_id as partnerId,
         store_id as storeId,
         status as status,
         fail_reason as failReason,
         create_time as createTime,
         update_time as updateTime
    </sql>

    <select id="selectOrder" resultType="cn.freemud.entities.db.PushMccafeOrder">
        SELECT
        <include refid="all_column"/>
        FROM push_mccafe_order WHERE order_code=#{orderCode}
    </select>

    <select id="selectOrderByStatus" resultType="cn.freemud.entities.db.PushMccafeOrder">
        SELECT
        <include refid="all_column"/>
        FROM push_mccafe_order WHERE status = 0
        id > #{id}
        limit 500;
    </select>

    <insert id="insertOrder" parameterType="cn.freemud.entities.db.PushMccafeOrder">
        INSERT INTO push_mccafe_order ( order_code, partner_id,store_id,status,fail_reason)
                       VALUES
                       ( #{orderCode},#{partnerId},#{storeId},#{status},#{failReason} );
    </insert>

    <update id="updateOrder" parameterType="cn.freemud.entities.db.PushMccafeOrder">
        updatee push_mccafe_order
        set
        status = #{status}
        where order_code = #{orderCode}
    </update>
</mapper>