283 lines
9.9 KiB
XML
283 lines
9.9 KiB
XML
|
<?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.UserExamMapper">
|
||
|
<resultMap id="BaseResultMap" type="com.joylink.ms.entity.UserExam">
|
||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||
|
<result column="user_id" jdbcType="BIGINT" property="userId" />
|
||
|
<result column="exam_id" jdbcType="BIGINT" property="examId" />
|
||
|
<result column="exam_name" jdbcType="VARCHAR" property="examName" />
|
||
|
<result column="score" jdbcType="REAL" property="score" />
|
||
|
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
||
|
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||
|
<result column="used_time" jdbcType="INTEGER" property="usedTime" />
|
||
|
<result column="result" jdbcType="VARCHAR" property="result" />
|
||
|
</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, user_id, exam_id, exam_name, score, start_time, end_time, used_time, result
|
||
|
</sql>
|
||
|
<select id="selectByExample" parameterType="com.joylink.ms.entity.UserExamExample" resultMap="BaseResultMap">
|
||
|
select
|
||
|
<if test="distinct">
|
||
|
distinct
|
||
|
</if>
|
||
|
<include refid="Base_Column_List" />
|
||
|
from user_exam
|
||
|
<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 user_exam
|
||
|
where id = #{id,jdbcType=BIGINT}
|
||
|
</select>
|
||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||
|
delete from user_exam
|
||
|
where id = #{id,jdbcType=BIGINT}
|
||
|
</delete>
|
||
|
<delete id="deleteByExample" parameterType="com.joylink.ms.entity.UserExamExample">
|
||
|
delete from user_exam
|
||
|
<if test="_parameter != null">
|
||
|
<include refid="Example_Where_Clause" />
|
||
|
</if>
|
||
|
</delete>
|
||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.joylink.ms.entity.UserExam">
|
||
|
insert into user_exam (id, user_id, exam_id,
|
||
|
exam_name, score, start_time,
|
||
|
end_time, used_time, result
|
||
|
)
|
||
|
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{examId,jdbcType=BIGINT},
|
||
|
#{examName,jdbcType=VARCHAR}, #{score,jdbcType=REAL}, #{startTime,jdbcType=TIMESTAMP},
|
||
|
#{endTime,jdbcType=TIMESTAMP}, #{usedTime,jdbcType=INTEGER}, #{result,jdbcType=VARCHAR}
|
||
|
)
|
||
|
</insert>
|
||
|
<insert id="insertSelective" parameterType="com.joylink.ms.entity.UserExam">
|
||
|
insert into user_exam
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="id != null">
|
||
|
id,
|
||
|
</if>
|
||
|
<if test="userId != null">
|
||
|
user_id,
|
||
|
</if>
|
||
|
<if test="examId != null">
|
||
|
exam_id,
|
||
|
</if>
|
||
|
<if test="examName != null">
|
||
|
exam_name,
|
||
|
</if>
|
||
|
<if test="score != null">
|
||
|
score,
|
||
|
</if>
|
||
|
<if test="startTime != null">
|
||
|
start_time,
|
||
|
</if>
|
||
|
<if test="endTime != null">
|
||
|
end_time,
|
||
|
</if>
|
||
|
<if test="usedTime != null">
|
||
|
used_time,
|
||
|
</if>
|
||
|
<if test="result != null">
|
||
|
result,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="id != null">
|
||
|
#{id,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="userId != null">
|
||
|
#{userId,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="examId != null">
|
||
|
#{examId,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="examName != null">
|
||
|
#{examName,jdbcType=VARCHAR},
|
||
|
</if>
|
||
|
<if test="score != null">
|
||
|
#{score,jdbcType=REAL},
|
||
|
</if>
|
||
|
<if test="startTime != null">
|
||
|
#{startTime,jdbcType=TIMESTAMP},
|
||
|
</if>
|
||
|
<if test="endTime != null">
|
||
|
#{endTime,jdbcType=TIMESTAMP},
|
||
|
</if>
|
||
|
<if test="usedTime != null">
|
||
|
#{usedTime,jdbcType=INTEGER},
|
||
|
</if>
|
||
|
<if test="result != null">
|
||
|
#{result,jdbcType=VARCHAR},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
<select id="countByExample" parameterType="com.joylink.ms.entity.UserExamExample" resultType="java.lang.Long">
|
||
|
select count(*) from user_exam
|
||
|
<if test="_parameter != null">
|
||
|
<include refid="Example_Where_Clause" />
|
||
|
</if>
|
||
|
</select>
|
||
|
<update id="updateByExampleSelective" parameterType="map">
|
||
|
update user_exam
|
||
|
<set>
|
||
|
<if test="record.id != null">
|
||
|
id = #{record.id,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="record.userId != null">
|
||
|
user_id = #{record.userId,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="record.examId != null">
|
||
|
exam_id = #{record.examId,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="record.examName != null">
|
||
|
exam_name = #{record.examName,jdbcType=VARCHAR},
|
||
|
</if>
|
||
|
<if test="record.score != null">
|
||
|
score = #{record.score,jdbcType=REAL},
|
||
|
</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.usedTime != null">
|
||
|
used_time = #{record.usedTime,jdbcType=INTEGER},
|
||
|
</if>
|
||
|
<if test="record.result != null">
|
||
|
result = #{record.result,jdbcType=VARCHAR},
|
||
|
</if>
|
||
|
</set>
|
||
|
<if test="_parameter != null">
|
||
|
<include refid="Update_By_Example_Where_Clause" />
|
||
|
</if>
|
||
|
</update>
|
||
|
<update id="updateByExample" parameterType="map">
|
||
|
update user_exam
|
||
|
set id = #{record.id,jdbcType=BIGINT},
|
||
|
user_id = #{record.userId,jdbcType=BIGINT},
|
||
|
exam_id = #{record.examId,jdbcType=BIGINT},
|
||
|
exam_name = #{record.examName,jdbcType=VARCHAR},
|
||
|
score = #{record.score,jdbcType=REAL},
|
||
|
start_time = #{record.startTime,jdbcType=TIMESTAMP},
|
||
|
end_time = #{record.endTime,jdbcType=TIMESTAMP},
|
||
|
used_time = #{record.usedTime,jdbcType=INTEGER},
|
||
|
result = #{record.result,jdbcType=VARCHAR}
|
||
|
<if test="_parameter != null">
|
||
|
<include refid="Update_By_Example_Where_Clause" />
|
||
|
</if>
|
||
|
</update>
|
||
|
<update id="updateByPrimaryKeySelective" parameterType="com.joylink.ms.entity.UserExam">
|
||
|
update user_exam
|
||
|
<set>
|
||
|
<if test="userId != null">
|
||
|
user_id = #{userId,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="examId != null">
|
||
|
exam_id = #{examId,jdbcType=BIGINT},
|
||
|
</if>
|
||
|
<if test="examName != null">
|
||
|
exam_name = #{examName,jdbcType=VARCHAR},
|
||
|
</if>
|
||
|
<if test="score != null">
|
||
|
score = #{score,jdbcType=REAL},
|
||
|
</if>
|
||
|
<if test="startTime != null">
|
||
|
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||
|
</if>
|
||
|
<if test="endTime != null">
|
||
|
end_time = #{endTime,jdbcType=TIMESTAMP},
|
||
|
</if>
|
||
|
<if test="usedTime != null">
|
||
|
used_time = #{usedTime,jdbcType=INTEGER},
|
||
|
</if>
|
||
|
<if test="result != null">
|
||
|
result = #{result,jdbcType=VARCHAR},
|
||
|
</if>
|
||
|
</set>
|
||
|
where id = #{id,jdbcType=BIGINT}
|
||
|
</update>
|
||
|
<update id="updateByPrimaryKey" parameterType="com.joylink.ms.entity.UserExam">
|
||
|
update user_exam
|
||
|
set user_id = #{userId,jdbcType=BIGINT},
|
||
|
exam_id = #{examId,jdbcType=BIGINT},
|
||
|
exam_name = #{examName,jdbcType=VARCHAR},
|
||
|
score = #{score,jdbcType=REAL},
|
||
|
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||
|
end_time = #{endTime,jdbcType=TIMESTAMP},
|
||
|
used_time = #{usedTime,jdbcType=INTEGER},
|
||
|
result = #{result,jdbcType=VARCHAR}
|
||
|
where id = #{id,jdbcType=BIGINT}
|
||
|
</update>
|
||
|
</mapper>
|