UfoBuyerOrderMapper.xml 10 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.search.dal.UfoBuyerOrderMapper">
    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ufo_order.BuyerOrder">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="uid" property="uid" jdbcType="INTEGER"/>
        <result column="order_code" property="orderCode" jdbcType="BIGINT"/>
        <result column="seller_uid" property="sellerUid" jdbcType="INTEGER"/>
        <result column="client_type" property="clientType" jdbcType="TINYINT"/>
        <result column="payment" property="payment" jdbcType="TINYINT"/>
        <result column="payment_type" property="paymentType" jdbcType="TINYINT"/>
        <result column="is_cancel" property="isCancel" jdbcType="TINYINT"/>
        <result column="amount" property="amount" jdbcType="DECIMAL"/>
        <result column="ship_fee" property="shipFee" jdbcType="DECIMAL"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime" jdbcType="INTEGER"/>
        <result column="seller_order_status" property="sellerOrderStatus" jdbcType="TINYINT"/>
        <result column="buyer_order_status" property="buyerOrderStatus" jdbcType="TINYINT"/>
        <result column="channel_no" property="channelNo" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
    id, uid, order_code, seller_uid, client_type, payment, payment_type, is_cancel, amount, 
    ship_fee, status, create_time, update_time, seller_order_status, buyer_order_status, 
    channel_no
  </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from buyer_order
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from buyer_order
    where id = #{id,jdbcType=INTEGER}
  </delete>
    <insert id="insert" parameterType="com.yoho.search.dal.model.ufo_order.BuyerOrder">
    insert into buyer_order (id, uid, order_code, 
      seller_uid, client_type, payment, 
      payment_type, is_cancel, amount, 
      ship_fee, status, create_time, 
      update_time, seller_order_status, buyer_order_status, 
      channel_no)
    values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, 
      #{sellerUid,jdbcType=INTEGER}, #{clientType,jdbcType=TINYINT}, #{payment,jdbcType=TINYINT}, 
      #{paymentType,jdbcType=TINYINT}, #{isCancel,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, 
      #{shipFee,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, 
      #{updateTime,jdbcType=INTEGER}, #{sellerOrderStatus,jdbcType=TINYINT}, #{buyerOrderStatus,jdbcType=TINYINT}, 
      #{channelNo,jdbcType=VARCHAR})
  </insert>
    <insert id="insertSelective" parameterType="com.yoho.search.dal.model.ufo_order.BuyerOrder">
        insert into buyer_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="uid != null">
                uid,
            </if>
            <if test="orderCode != null">
                order_code,
            </if>
            <if test="sellerUid != null">
                seller_uid,
            </if>
            <if test="clientType != null">
                client_type,
            </if>
            <if test="payment != null">
                payment,
            </if>
            <if test="paymentType != null">
                payment_type,
            </if>
            <if test="isCancel != null">
                is_cancel,
            </if>
            <if test="amount != null">
                amount,
            </if>
            <if test="shipFee != null">
                ship_fee,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="sellerOrderStatus != null">
                seller_order_status,
            </if>
            <if test="buyerOrderStatus != null">
                buyer_order_status,
            </if>
            <if test="channelNo != null">
                channel_no,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="uid != null">
                #{uid,jdbcType=INTEGER},
            </if>
            <if test="orderCode != null">
                #{orderCode,jdbcType=BIGINT},
            </if>
            <if test="sellerUid != null">
                #{sellerUid,jdbcType=INTEGER},
            </if>
            <if test="clientType != null">
                #{clientType,jdbcType=TINYINT},
            </if>
            <if test="payment != null">
                #{payment,jdbcType=TINYINT},
            </if>
            <if test="paymentType != null">
                #{paymentType,jdbcType=TINYINT},
            </if>
            <if test="isCancel != null">
                #{isCancel,jdbcType=TINYINT},
            </if>
            <if test="amount != null">
                #{amount,jdbcType=DECIMAL},
            </if>
            <if test="shipFee != null">
                #{shipFee,jdbcType=DECIMAL},
            </if>
            <if test="status != null">
                #{status,jdbcType=TINYINT},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="sellerOrderStatus != null">
                #{sellerOrderStatus,jdbcType=TINYINT},
            </if>
            <if test="buyerOrderStatus != null">
                #{buyerOrderStatus,jdbcType=TINYINT},
            </if>
            <if test="channelNo != null">
                #{channelNo,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ufo_order.BuyerOrder">
        update buyer_order
        <set>
            <if test="uid != null">
                uid = #{uid,jdbcType=INTEGER},
            </if>
            <if test="orderCode != null">
                order_code = #{orderCode,jdbcType=BIGINT},
            </if>
            <if test="sellerUid != null">
                seller_uid = #{sellerUid,jdbcType=INTEGER},
            </if>
            <if test="clientType != null">
                client_type = #{clientType,jdbcType=TINYINT},
            </if>
            <if test="payment != null">
                payment = #{payment,jdbcType=TINYINT},
            </if>
            <if test="paymentType != null">
                payment_type = #{paymentType,jdbcType=TINYINT},
            </if>
            <if test="isCancel != null">
                is_cancel = #{isCancel,jdbcType=TINYINT},
            </if>
            <if test="amount != null">
                amount = #{amount,jdbcType=DECIMAL},
            </if>
            <if test="shipFee != null">
                ship_fee = #{shipFee,jdbcType=DECIMAL},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=TINYINT},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="sellerOrderStatus != null">
                seller_order_status = #{sellerOrderStatus,jdbcType=TINYINT},
            </if>
            <if test="buyerOrderStatus != null">
                buyer_order_status = #{buyerOrderStatus,jdbcType=TINYINT},
            </if>
            <if test="channelNo != null">
                channel_no = #{channelNo,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.ufo_order.BuyerOrder">
    update buyer_order
    set uid = #{uid,jdbcType=INTEGER},
      order_code = #{orderCode,jdbcType=BIGINT},
      seller_uid = #{sellerUid,jdbcType=INTEGER},
      client_type = #{clientType,jdbcType=TINYINT},
      payment = #{payment,jdbcType=TINYINT},
      payment_type = #{paymentType,jdbcType=TINYINT},
      is_cancel = #{isCancel,jdbcType=TINYINT},
      amount = #{amount,jdbcType=DECIMAL},
      ship_fee = #{shipFee,jdbcType=DECIMAL},
      status = #{status,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=INTEGER},
      seller_order_status = #{sellerOrderStatus,jdbcType=TINYINT},
      buyer_order_status = #{buyerOrderStatus,jdbcType=TINYINT},
      channel_no = #{channelNo,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <select id="selectSaleCountByOrderCodeList" resultType="java.lang.Integer" timeout="20000">
        select count(1)
        from buyer_order
        WHERE
        order_code in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        and status in (1,2,3,4,5)
    </select>
    <select id="selectLastThirtyDaySaleCountByOrderCodeList" resultType="java.lang.Integer" timeout="20000">
        select count(1)
        from buyer_order
        WHERE
        order_code in
        <foreach item="item" index="index" collection="orderCodeList"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        and status in (1,2,3,4,5)
        and create_time > #{lastThirtyDayTime}
    </select>
</mapper>