OrderShareCouponMapper.xml 3.64 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.yoho.coupon.dal.IOrderShareCouponDAO">
	<resultMap id="BaseResultMap" type="com.yoho.coupon.dal.model.OrderShareCoupon">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="coupon_id" property="couponId" jdbcType="VARCHAR" />
		<result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
		<result column="use_date" property="useDate" jdbcType="VARCHAR" />
		<result column="coupon_type" property="couponType" jdbcType="TINYINT" />
		<result column="activity_id" property="activityId" jdbcType="INTEGER" />
		<result column="coupon_pic" property="couponPic" jdbcType="VARCHAR" />
	</resultMap>
	<sql id="Base_Column_List">
		id, coupon_id, coupon_name, use_date, coupon_type,activity_id,coupon_pic
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from order_share_coupon
		where id = #{id,jdbcType=INTEGER}
	</select>
	<select id="selectCouponByDateAndType" resultMap="BaseResultMap">
		select * from order_share_coupon where activity_id=#{activityId}
		<if test="useDate != null">
			and use_date=#{useDate}
		</if>
		<if test="couponType != null">
			and coupon_type=#{couponType}
		</if>
		limit 1
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
		delete from order_share_coupon
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
		insert into order_share_coupon (id, coupon_id, coupon_name,
		use_date, coupon_type)
		values (#{id,jdbcType=INTEGER}, #{couponId,jdbcType=VARCHAR},
		#{couponName,jdbcType=VARCHAR},
		#{useDate,jdbcType=VARCHAR}, #{couponType,jdbcType=TINYINT})
	</insert>
	<insert id="insertSelective" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
		insert into order_share_coupon
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="couponId != null">
				coupon_id,
			</if>
			<if test="couponName != null">
				coupon_name,
			</if>
			<if test="useDate != null">
				use_date,
			</if>
			<if test="couponType != null">
				coupon_type,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=INTEGER},
			</if>
			<if test="couponId != null">
				#{couponId,jdbcType=VARCHAR},
			</if>
			<if test="couponName != null">
				#{couponName,jdbcType=VARCHAR},
			</if>
			<if test="useDate != null">
				#{useDate,jdbcType=VARCHAR},
			</if>
			<if test="couponType != null">
				#{couponType,jdbcType=TINYINT},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
		update order_share_coupon
		<set>
			<if test="couponId != null">
				coupon_id = #{couponId,jdbcType=VARCHAR},
			</if>
			<if test="couponName != null">
				coupon_name = #{couponName,jdbcType=VARCHAR},
			</if>
			<if test="useDate != null">
				use_date = #{useDate,jdbcType=VARCHAR},
			</if>
			<if test="couponType != null">
				coupon_type = #{couponType,jdbcType=TINYINT},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
		update order_share_coupon
		set coupon_id = #{couponId,jdbcType=VARCHAR},
		coupon_name = #{couponName,jdbcType=VARCHAR},
		use_date = #{useDate,jdbcType=VARCHAR},
		coupon_type = #{couponType,jdbcType=TINYINT}
		where id = #{id,jdbcType=INTEGER}
	</update>
</mapper>