OrdersPrePayMapper.xml 1.98 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.OrdersPrePayMapper" >
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.OrdersPrePay" >
    <id column="order_code" property="orderCode" jdbcType="BIGINT" />
    <result column="uid" property="uid" jdbcType="INTEGER" />
    <result column="payment" property="payment" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="update_num" property="updateNum" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    order_code, uid, payment, create_time, update_time, update_num
  </sql>

  <insert id="insertOnDuplicateUpdate" parameterType="com.yohoufo.dal.order.model.OrdersPrePay" >
    insert into orders_pre_pay (order_code, uid, payment, create_time, update_time, update_num)
    values(#{orderCode,jdbcType=BIGINT}, #{uid,jdbcType=INTEGER}, #{payment,jdbcType=INTEGER},
    #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{updateNum,jdbcType=INTEGER})
    on duplicate key update payment = #{payment,jdbcType=INTEGER}, update_time = #{updateTime,jdbcType=INTEGER},update_num = update_num +  #{updateNum,jdbcType=INTEGER}
  </insert>

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

  
  <select id="selectByOrderCodes" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from orders_pre_pay
    where order_code IN 
    <foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=",">
      #{orderCode,jdbcType=BIGINT}
    </foreach>

  </select>
</mapper>