DrawlineActivityLuckydrawMapper.xml 4.24 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.IDrawlineActivityLuckydrawDAO">
	<resultMap id="BaseResultMap" type="com.yoho.queue.dal.model.DrawlineActivityLuckydraw">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="end_time" property="endTime" jdbcType="INTEGER" />
		<result column="draw_status" property="drawStatus" jdbcType="TINYINT" />
		<result column="status" property="status" jdbcType="TINYINT" />
		<result column="create_time" property="createTime" jdbcType="INTEGER" />
		<result column="update_time" property="updateTime" jdbcType="INTEGER" />
	</resultMap>
	<sql id="Base_Column_List">
		id, end_time, draw_status, status, create_time, update_time
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from drawline_activity_luckydraw
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
		delete from drawline_activity_luckydraw
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.yoho.queue.dal.model.DrawlineActivityLuckydraw">
		insert into drawline_activity_luckydraw (id, end_time, draw_status,
		status, create_time, update_time
		)
		values (#{id,jdbcType=INTEGER},
		#{endTime,jdbcType=INTEGER}, #{drawStatus,jdbcType=TINYINT},
		#{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}
		)
	</insert>
	<insert id="insertSelective" parameterType="com.yoho.queue.dal.model.DrawlineActivityLuckydraw">
		insert into drawline_activity_luckydraw
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="endTime != null">
				end_time,
			</if>
			<if test="drawStatus != null">
				draw_status,
			</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="endTime != null">
				#{endTime,jdbcType=INTEGER},
			</if>
			<if test="drawStatus != null">
				#{drawStatus,jdbcType=TINYINT},
			</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.DrawlineActivityLuckydraw">
		update drawline_activity_luckydraw
		<set>
			<if test="endTime != null">
				end_time = #{endTime,jdbcType=INTEGER},
			</if>
			<if test="drawStatus != null">
				draw_status = #{drawStatus,jdbcType=TINYINT},
			</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.DrawlineActivityLuckydraw">
		update drawline_activity_luckydraw
		set end_time = #{endTime,jdbcType=INTEGER},
		draw_status = #{drawStatus,jdbcType=TINYINT},
		status =
		#{status,jdbcType=TINYINT},
		create_time = #{createTime,jdbcType=INTEGER},
		update_time = #{updateTime,jdbcType=INTEGER}
		where id = #{id,jdbcType=INTEGER}
	</update>

	<insert id="insertBatch" parameterType="java.util.List">
		insert into drawline_activity_luckydraw (id, end_time, draw_status, status, create_time, update_time)
		values
		<foreach collection="list" item="item" index="index" separator=",">
			(#{item.id}, #{item.endTime}, #{item.drawStatus}, #{item.status}, #{item.createTime}, #{item.updateTime})
		</foreach>
	</insert>
	
	<select id="selectByIdAndStatus" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from drawline_activity_luckydraw
		where id = #{id,jdbcType=INTEGER} and status = '1' limit 1;
	</select>
</mapper>