<?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.DuoshiwuDao">

    <resultMap id="ResultMap" type="com.zm.order.tool.server.model.Duoshiwu">
        <result column="id" jdbcType="BIGINT" property="id"/>
        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
        <result column="user_id" jdbcType="BIGINT" property="userId"/>
        <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
        <result column="total_amount" jdbcType="DECIMAL" property="totalAmount"/>
        <result column="pay_amount" jdbcType="DECIMAL" property="payAmount"/>
        <result column="actual_amount" jdbcType="DECIMAL" property="actualAmount"/>
        <result column="discount_amount" jdbcType="DECIMAL" property="discountAmount"/>
        <result column="order_at" jdbcType="TIMESTAMP" property="orderAt"/>
        <result column="pay_at" jdbcType="TIMESTAMP" property="payAt"/>
    </resultMap>

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

    <sql id="cols_all">
        id,
        order_no,
        user_id,
        mobile,
        total_amount,
        pay_amount,
        actual_amount,
        discount_amount,
        order_at,
        pay_at
    </sql>

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