DrawlineActivityMapper.xml 6.63 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.queue.dal.IDrawlineActivityDAO">
	<resultMap id="BaseResultMap" type="com.yoho.queue.dal.model.DrawlineActivity">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="activity_name" property="activityName" jdbcType="VARCHAR" />
		<result column="begin_time" property="beginTime" jdbcType="INTEGER" />
		<result column="end_time" property="endTime" jdbcType="INTEGER" />
		<result column="top_banner" property="topBanner" jdbcType="VARCHAR" />
		<result column="background_style" property="backgroundStyle" jdbcType="VARCHAR" />
		<result column="activity_desc" property="activityDesc" jdbcType="VARCHAR" />
		<result column="status" property="status" jdbcType="TINYINT" />
		<result column="create_time" property="createTime" jdbcType="INTEGER" />
		<result column="update_time" property="updateTime" jdbcType="INTEGER" />
		<result column="number_limit" property="numberLimit" jdbcType="INTEGER" />
		<result column="platform_type" property="platformType" jdbcType="INTEGER" />
	</resultMap>
	<sql id="Base_Column_List">
		id, activity_name, begin_time, end_time, top_banner, background_style,
		activity_desc, status, create_time, update_time, number_limit, platform_type
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from drawline_activity
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
		delete from drawline_activity
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.yoho.queue.dal.model.DrawlineActivity">
		insert into drawline_activity (id, activity_name, begin_time,
		end_time, award_type, top_banner,
		background_style, activity_desc, status,
		create_time,
		update_time)
		values (#{id,jdbcType=INTEGER}, #{activityName,jdbcType=VARCHAR}, #{beginTime,jdbcType=INTEGER},
		#{endTime,jdbcType=INTEGER}, #{awardType,jdbcType=TINYINT}, #{topBanner,jdbcType=VARCHAR},
		#{backgroundStyle,jdbcType=VARCHAR}, #{activityDesc,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
		#{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER})
	</insert>
	<insert id="insertSelective" parameterType="com.yoho.queue.dal.model.DrawlineActivity">
		insert into drawline_activity
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="activityName != null">
				activity_name,
			</if>
			<if test="beginTime != null">
				begin_time,
			</if>
			<if test="endTime != null">
				end_time,
			</if>
			<if test="awardType != null">
				award_type,
			</if>
			<if test="topBanner != null">
				top_banner,
			</if>
			<if test="backgroundStyle != null">
				background_style,
			</if>
			<if test="activityDesc != null">
				activity_desc,
			</if>
			<if test="status != null">
				status,
			</if>
			<if test="createTime != null">
				create_time,
			</if>
			<if test="updateTime != null">
				update_time,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=INTEGER},
			</if>
			<if test="activityName != null">
				#{activityName,jdbcType=VARCHAR},
			</if>
			<if test="beginTime != null">
				#{beginTime,jdbcType=INTEGER},
			</if>
			<if test="endTime != null">
				#{endTime,jdbcType=INTEGER},
			</if>
			<if test="awardType != null">
				#{awardType,jdbcType=TINYINT},
			</if>
			<if test="topBanner != null">
				#{topBanner,jdbcType=VARCHAR},
			</if>
			<if test="backgroundStyle != null">
				#{backgroundStyle,jdbcType=VARCHAR},
			</if>
			<if test="activityDesc != null">
				#{activityDesc,jdbcType=VARCHAR},
			</if>
			<if test="status != null">
				#{status,jdbcType=TINYINT},
			</if>
			<if test="createTime != null">
				#{createTime,jdbcType=INTEGER},
			</if>
			<if test="updateTime != null">
				#{updateTime,jdbcType=INTEGER},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.yoho.queue.dal.model.DrawlineActivity">
		update drawline_activity
		<set>
			<if test="activityName != null">
				activity_name = #{activityName,jdbcType=VARCHAR},
			</if>
			<if test="beginTime != null">
				begin_time = #{beginTime,jdbcType=INTEGER},
			</if>
			<if test="endTime != null">
				end_time = #{endTime,jdbcType=INTEGER},
			</if>
			<if test="awardType != null">
				award_type = #{awardType,jdbcType=TINYINT},
			</if>
			<if test="topBanner != null">
				top_banner = #{topBanner,jdbcType=VARCHAR},
			</if>
			<if test="backgroundStyle != null">
				background_style = #{backgroundStyle,jdbcType=VARCHAR},
			</if>
			<if test="activityDesc != null">
				activity_desc = #{activityDesc,jdbcType=VARCHAR},
			</if>
			<if test="status != null">
				status = #{status,jdbcType=TINYINT},
			</if>
			<if test="createTime != null">
				create_time = #{createTime,jdbcType=INTEGER},
			</if>
			<if test="updateTime != null">
				update_time = #{updateTime,jdbcType=INTEGER},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.yoho.queue.dal.model.DrawlineActivity">
		update drawline_activity
		set activity_name = #{activityName,jdbcType=VARCHAR},
		begin_time = #{beginTime,jdbcType=INTEGER},
		end_time =
		#{endTime,jdbcType=INTEGER},
		award_type = #{awardType,jdbcType=TINYINT},
		top_banner = #{topBanner,jdbcType=VARCHAR},
		background_style = #{backgroundStyle,jdbcType=VARCHAR},
		activity_desc =
		#{activityDesc,jdbcType=VARCHAR},
		status = #{status,jdbcType=TINYINT},
		create_time = #{createTime,jdbcType=INTEGER},
		update_time = #{updateTime,jdbcType=INTEGER}
		where id = #{id,jdbcType=INTEGER}
	</update>

	<select id="selectByNotLuckydraw" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from drawline_activity
		where status = 1 and id not in (select id from drawline_activity_luckydraw where draw_status = 1 and status = 1)
	</select>
	<select id="selectAllActivity" resultMap="BaseResultMap">
		select * from drawline_activity where status=1 and begin_time&lt;=#{currentTime} and end_time &gt;=#{currentTime}
	</select>
	
	<select id="selectActivityById" resultMap="BaseResultMap">
		select * from drawline_activity where id=#{activityId} and status=1 and begin_time&lt;=#{currentTime} and end_time &gt;=#{currentTime}
	</select>

	<select id="selectActivityByIdList" resultMap="BaseResultMap">
		select * from drawline_activity
		where status=1
		and id in
		<foreach collection="list" item="item" open="(" close=")" separator=",">
			#{item}
		</foreach>
	</select>
</mapper>