OrderCouponMapper.xml
1.38 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="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.OrderCoupon" useGeneratedKeys="true">
insert into order_coupon (uid, order_code, coupon_code,create_time)
values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{couponCode,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER})
</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 1
</select>
</mapper>