<?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.dao.WmOrderDiscountDao">

    <resultMap id="WmOrderDiscountMap" type="com.zm.order.tool.server.model.WmOrderDiscount">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="amount" jdbcType="DECIMAL" property="amount"/>
        <result column="user_id" jdbcType="BIGINT" property="userId"/>
        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
    </resultMap>

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

    <sql id="cols_all">
        id,
        <include refid="cols_exclude_id"/>
    </sql>

    <sql id="cols_exclude_id">
    amount, user_id, order_no
    </sql>

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


    <select id="selectList" parameterType="map" resultMap="WmOrderDiscountMap">
        select
        <include refid="cols_all"/>
        from
        <include refid="tb"/>
        where 
        <![CDATA[  id >= #{startId} ]]>
        <![CDATA[ and id <= #{endId} ]]>
    </select>
</mapper>