<?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.zm.order.tool.server.tempdb.OrderWuYinItemDao">

    <resultMap id="JuiceOrderMap" type="com.zm.order.tool.server.model.OrderWuyinItem">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="order_code" jdbcType="VARCHAR" property="orderCode"/>
        <result column="item_name" jdbcType="VARCHAR" property="itemName"/>
        <result column="num" jdbcType="VARCHAR" property="num"/>
        <result column="item_price" jdbcType="DECIMAL" property="itemPrice"/>
        <result column="discount_amount" jdbcType="DECIMAL" property="discountAmount"/>
        <result column="pay_amount" jdbcType="DECIMAL" property="payAmount"/>
        <result column="total_amount" jdbcType="DECIMAL" property="totalAmount"/>
    </resultMap>

    <sql id="tb">
        order_wuyin_item
    </sql>

    <sql id="cols_all">
        id,
        order_code,
        item_name,
        num,
        item_price,
        discount_amount,
        pay_amount,
        total_amount
    </sql>

    <select id="selectList" parameterType="map" resultMap="JuiceOrderMap">
        select
        <include refid="cols_all"/>
        from
        <include refid="tb"/>
        <where>
            <if test="lastId != null">
                id > #{lastId}
            </if>
        </where>
            order by id asc limit #{size}
    </select>

    <select id="selectOne" parameterType="map" resultMap="JuiceOrderMap">
        select
        <include refid="cols_all"/>
        from
        <include refid="tb"/>
        where
        order_code = #{orderCode}
    </select>
</mapper>