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

148 lines
5.4 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="club.joylink.rtss.dao.StudentRelLessonClassDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.StudentRelLessonClass">
<result column="lesson_id" jdbcType="BIGINT" property="lessonId" />
<result column="class_id" jdbcType="INTEGER" property="classId" />
</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">
lesson_id, class_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.StudentRelLessonClassExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from student_rel_lesson_class
<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>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.StudentRelLessonClassExample">
delete from student_rel_lesson_class
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.StudentRelLessonClass">
insert into student_rel_lesson_class (lesson_id, class_id)
values (#{lessonId,jdbcType=BIGINT}, #{classId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.StudentRelLessonClass">
insert into student_rel_lesson_class
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
lesson_id,
</if>
<if test="classId != null">
class_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
#{lessonId,jdbcType=BIGINT},
</if>
<if test="classId != null">
#{classId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.StudentRelLessonClassExample" resultType="java.lang.Long">
select count(*) from student_rel_lesson_class
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update student_rel_lesson_class
<set>
<if test="record.lessonId != null">
lesson_id = #{record.lessonId,jdbcType=BIGINT},
</if>
<if test="record.classId != null">
class_id = #{record.classId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update student_rel_lesson_class
set lesson_id = #{record.lessonId,jdbcType=BIGINT},
class_id = #{record.classId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>