OrderCouponMapper.xml
1.44 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.OrderCouponMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.OrderCoupon">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="uid" jdbcType="INTEGER" property="uid"/>
<result column="order_code" jdbcType="BIGINT" property="orderCode"/>
<result column="coupon_code" jdbcType="VARCHAR" property="couponCode"/>
<result column="create_time" jdbcType="INTEGER" property="createTime"/>
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, coupon_code, create_time
</sql>
<insert id="insertBatch" parameterType="java.util.List">
insert into order_coupon (uid, order_code, coupon_code,create_time)
values
<foreach collection="list" item="record" separator=",">
(#{record.uid,jdbcType=INTEGER}, #{record.orderCode,jdbcType=BIGINT}, #{record.couponCode,jdbcType=VARCHAR},
#{record.createTime,jdbcType=INTEGER})
</foreach>
</insert>
<select id="selectByUidAndOrderCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from order_coupon
where order_code = #{orderCode,jdbcType=BIGINT}
and uid = #{uid,jdbcType=INTEGER}
limit 2
</select>
</mapper>