rt-sim-training-service/src/main/resources/mybatis/mapper/ExamDefinitionMapper.xml

361 lines
13 KiB
XML
Raw Normal View History

2020-11-19 10:07:10 +08:00
<?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.joylink.ms.dao.ExamDefinitionMapper">
<resultMap id="BaseResultMap" type="com.joylink.ms.entity.ExamDefinition">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="lesson_id" jdbcType="BIGINT" property="lessonId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="duration" jdbcType="INTEGER" property="duration" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="full_point" jdbcType="INTEGER" property="fullPoint" />
<result column="passing_point" jdbcType="INTEGER" property="passingPoint" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="trial" jdbcType="BIT" property="trial" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, lesson_id, name, type, duration, start_time, end_time, full_point, passing_point,
creator_id, create_time, remarks, status, trial
</sql>
<select id="selectByExample" parameterType="com.joylink.ms.entity.ExamDefinitionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from exam_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from exam_definition
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from exam_definition
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.joylink.ms.entity.ExamDefinitionExample">
delete from exam_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.joylink.ms.entity.ExamDefinition">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into exam_definition (lesson_id, name, type,
duration, start_time, end_time,
full_point, passing_point, creator_id,
create_time, remarks, status,
trial)
values (#{lessonId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{duration,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{fullPoint,jdbcType=INTEGER}, #{passingPoint,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{trial,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="com.joylink.ms.entity.ExamDefinition">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into exam_definition
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
lesson_id,
</if>
<if test="name != null">
name,
</if>
<if test="type != null">
type,
</if>
<if test="duration != null">
duration,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="fullPoint != null">
full_point,
</if>
<if test="passingPoint != null">
passing_point,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="remarks != null">
remarks,
</if>
<if test="status != null">
status,
</if>
<if test="trial != null">
trial,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
#{lessonId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="duration != null">
#{duration,jdbcType=INTEGER},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="fullPoint != null">
#{fullPoint,jdbcType=INTEGER},
</if>
<if test="passingPoint != null">
#{passingPoint,jdbcType=INTEGER},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="remarks != null">
#{remarks,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="trial != null">
#{trial,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.joylink.ms.entity.ExamDefinitionExample" resultType="java.lang.Long">
select count(*) from exam_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update exam_definition
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.lessonId != null">
lesson_id = #{record.lessonId,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.duration != null">
duration = #{record.duration,jdbcType=INTEGER},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.fullPoint != null">
full_point = #{record.fullPoint,jdbcType=INTEGER},
</if>
<if test="record.passingPoint != null">
passing_point = #{record.passingPoint,jdbcType=INTEGER},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.remarks != null">
remarks = #{record.remarks,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.trial != null">
trial = #{record.trial,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update exam_definition
set id = #{record.id,jdbcType=BIGINT},
lesson_id = #{record.lessonId,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
type = #{record.type,jdbcType=VARCHAR},
duration = #{record.duration,jdbcType=INTEGER},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
full_point = #{record.fullPoint,jdbcType=INTEGER},
passing_point = #{record.passingPoint,jdbcType=INTEGER},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
remarks = #{record.remarks,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
trial = #{record.trial,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.joylink.ms.entity.ExamDefinition">
update exam_definition
<set>
<if test="lessonId != null">
lesson_id = #{lessonId,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="duration != null">
duration = #{duration,jdbcType=INTEGER},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="fullPoint != null">
full_point = #{fullPoint,jdbcType=INTEGER},
</if>
<if test="passingPoint != null">
passing_point = #{passingPoint,jdbcType=INTEGER},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="remarks != null">
remarks = #{remarks,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="trial != null">
trial = #{trial,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.joylink.ms.entity.ExamDefinition">
update exam_definition
set lesson_id = #{lessonId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
duration = #{duration,jdbcType=INTEGER},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
full_point = #{fullPoint,jdbcType=INTEGER},
passing_point = #{passingPoint,jdbcType=INTEGER},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
remarks = #{remarks,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
trial = #{trial,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>