OrderOverTimeMapper.xml 2.51 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.yohoufo.dal.order.OrderOverTimeMapper" >
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.OrderOverTime" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="order_code" property="orderCode" jdbcType="BIGINT" />
    <result column="delivery_time" property="deliveryTime" jdbcType="INTEGER" />
    <result column="delivery_minutes" property="deliveryMinutes" jdbcType="INTEGER" />
    <result column="sham_send_time" property="shamSendTime" jdbcType="INTEGER" />
    <result column="mini_fault_confirm_minutes" property="miniFaultConfirmMinutes" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, order_code, delivery_time, delivery_minutes, sham_send_time,mini_fault_confirm_minutes
  </sql>
   <insert id="insertDeliveryTime" parameterType="com.yohoufo.dal.order.model.OrderOverTime" >
    insert into order_over_time (order_code, delivery_time, delivery_minutes)
    values (#{orderCode,jdbcType=BIGINT}, #{deliveryTime,jdbcType=INTEGER}, #{deliveryMinutes,jdbcType=INTEGER})
    ON DUPLICATE KEY UPDATE delivery_time = #{deliveryTime, jdbcType=INTEGER}, delivery_minutes = #{deliveryMinutes,jdbcType=INTEGER}
  </insert>
  <insert id="insertShamSendTime" parameterType="com.yohoufo.dal.order.model.OrderOverTime" >
    insert into order_over_time (order_code, sham_send_time)
    values (#{orderCode,jdbcType=BIGINT}, #{shamSendTime,jdbcType=INTEGER})
    ON DUPLICATE KEY UPDATE sham_send_time = #{shamSendTime,jdbcType=INTEGER}
  </insert>
  <insert id="insertMiniFaultConfirmTime" parameterType="com.yohoufo.dal.order.model.OrderOverTime" >
    insert into order_over_time (order_code, mini_fault_confirm_minutes)
    values (#{orderCode,jdbcType=BIGINT}, #{miniFaultConfirmMinutes,jdbcType=INTEGER})
    ON DUPLICATE KEY UPDATE mini_fault_confirm_minutes = #{miniFaultConfirmMinutes,jdbcType=INTEGER}
  </insert>
  <select id="selectByOrderCodes" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from order_over_time
    where order_code IN
    <foreach collection="orderCodeList" open="(" close=")" separator="," item="item">
      #{item, jdbcType=BIGINT}
    </foreach>

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