DepositOrderMapper.xml 3.39 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.DepositOrderMapper" >
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.DepositOrder" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="uid" property="uid" jdbcType="INTEGER" />
    <result column="order_code" property="orderCode" jdbcType="BIGINT" />
    <result column="deposit_code" property="depositCode" jdbcType="VARCHAR" />
    <result column="amount" property="amount" jdbcType="DECIMAL" />
    <result column="contract_fee" property="contractFee" jdbcType="DECIMAL" />
    <result column="ship_fee" property="shipFee" jdbcType="DECIMAL" />
    <result column="payment" property="payment" jdbcType="INTEGER" />
    <result column="client_type" property="clientType" jdbcType="INTEGER" />
    <result column="event_type" property="eventType" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, uid, order_code, deposit_code, amount, payment, client_type, event_type, status, 
    create_time, update_time, ship_fee, contract_fee
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from deposit_order
    where id = #{id,jdbcType=INTEGER}
  </select>

  <insert id="insert" parameterType="com.yohoufo.dal.order.model.DepositOrder" >
    insert into deposit_order (id, uid, order_code, 
      deposit_code, amount, payment, 
      client_type, event_type, status, 
      create_time, update_time, contract_fee,ship_fee)
    values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, 
      #{depositCode,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{payment,jdbcType=INTEGER}, 
      #{clientType,jdbcType=INTEGER}, #{eventType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
      #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{contractFee,jdbcType=DECIMAL}, #{shipFee,jdbcType=DECIMAL})
  </insert>


  <update id="updatePayment" parameterType="com.yohoufo.dal.order.model.DepositOrder">
    update deposit_order
    set payment = #{payment,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=INTEGER}
    where uid = #{uid,jdbcType=INTEGER} AND order_code = #{orderCode,jdbcType=BIGINT}
  </update>

  <update id="updateStatusByOrderCode" parameterType="com.yohoufo.dal.order.model.DepositOrder">
    update deposit_order
    set status = #{status,jdbcType=INTEGER},
    update_time = #{updateTime,jdbcType=INTEGER}
    where order_code = #{orderCode,jdbcType=BIGINT} AND status = #{initStatus,jdbcType=INTEGER}
  </update>

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

  <select id="selectByDepositCode" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from deposit_order
    where  deposit_code = #{depositCode,jdbcType=VARCHAR} AND status = 1 AND event_type = #{eventType,jdbcType=INTEGER} limit 1
  </select>
</mapper>