IOrdersMapper.xml 2.99 KB
<?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.yoho.unions.dal.IOrdersMapper">
    <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.Orders">
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="order_code" property="orderCode" jdbcType="BIGINT" />
        <result column="uid" property="uid" jdbcType="INTEGER" />
        <result column="user_level" property="userLevel" jdbcType="TINYINT" />
        <result column="parent_order_code" property="parentOrderCode" jdbcType="BIGINT" />
        <result column="order_amount" property="orderAmount" jdbcType="DECIMAL" />
        <result column="last_order_amount" property="lastOrderAmount" jdbcType="DECIMAL" />
        <result column="express_number" property="expressNumber" jdbcType="VARCHAR" />
        <result column="order_type" property="orderType" jdbcType="TINYINT" />
        <result column="yoho_coin_num" property="yohoCoinNum" jdbcType="INTEGER" />
        <result column="payment_status" property="paymentStatus" jdbcType="TINYINT" />
        <result column="payment_type" property="paymentType" jdbcType="TINYINT" />
        <result column="payment" property="payment" jdbcType="TINYINT" />
        <result column="shipping_cost" property="shippingCost" jdbcType="DECIMAL" />
        <result column="remark" property="remark" jdbcType="VARCHAR" />
        <result column="order_status" property="orderStatus" jdbcType="INTEGER" />
        <result column="new_user_orders" property="newUserOrders" jdbcType="CHAR" />
        <result column="create_time" property="createTime" jdbcType="CHAR" />

    </resultMap>
    
    <sql id="Base_Column_List">
    id, order_code, uid, user_level, parent_order_code, order_amount,
    last_order_amount, express_number,order_type,
    yoho_coin_num, payment_status, payment_type,
    payment, shipping_cost, remark,
    order_status,new_user_orders,create_time
  	</sql>


    <select id="selectByUidAndOrderCode" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from orders
        where order_code = #{orderCode,jdbcType=BIGINT} and uid = #{uid,jdbcType=INTEGER}
    </select>

    <select id="selectByOrderCode" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from orders
        where parent_order_code = #{orderCode,jdbcType=BIGINT}
    </select>

    <select id="selectByOrderCodeList" resultMap="BaseResultMap">
        select <include refid="Base_Column_List" />
        from orders where parent_order_code in
        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    
    <select id="selectCountShipStatusOrderSince" resultType="java.lang.Integer">
        select count(1)
        from orders
        where uid = #{uid,jdbcType=INTEGER}
        	and order_status in(600,700)
    </select>    

</mapper>