85 lines
4.2 KiB
XML
85 lines
4.2 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.luqj.exam.mapper.ExamQuestionFavoriteMapper">
|
|
|
|
<resultMap type="ExamQuestionFavorite" id="ExamQuestionFavoriteResult">
|
|
<result property="id" column="id" />
|
|
<result property="questionId" column="question_id" />
|
|
<result property="studentId" column="student_id" />
|
|
<result property="categoryId" column="category_id" />
|
|
<result property="categoryName" column="category_name" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="source" column="source" />
|
|
<result property="schoolId" column="school_id" />
|
|
</resultMap>
|
|
|
|
<sql id="selectExamQuestionFavoriteVo">
|
|
select id, question_id, student_id, category_id, category_name, create_time, source, school_id from exam_question_favorite
|
|
</sql>
|
|
|
|
<select id="selectExamQuestionFavoriteList" parameterType="ExamQuestionFavorite" resultMap="ExamQuestionFavoriteResult">
|
|
<include refid="selectExamQuestionFavoriteVo"/>
|
|
<where>
|
|
<if test="questionId != null "> and question_id = #{questionId}</if>
|
|
<if test="studentId != null "> and student_id = #{studentId}</if>
|
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
|
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
|
|
<if test="source != null "> and source = #{source}</if>
|
|
<if test="schoolId != null "> and school_id = #{schoolId}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectExamQuestionFavoriteById" parameterType="Long" resultMap="ExamQuestionFavoriteResult">
|
|
<include refid="selectExamQuestionFavoriteVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertExamQuestionFavorite" parameterType="ExamQuestionFavorite" useGeneratedKeys="true" keyProperty="id">
|
|
insert into exam_question_favorite
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="questionId != null">question_id,</if>
|
|
<if test="studentId != null">student_id,</if>
|
|
<if test="categoryId != null">category_id,</if>
|
|
<if test="categoryName != null">category_name,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="source != null">source,</if>
|
|
<if test="schoolId != null">school_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="questionId != null">#{questionId},</if>
|
|
<if test="studentId != null">#{studentId},</if>
|
|
<if test="categoryId != null">#{categoryId},</if>
|
|
<if test="categoryName != null">#{categoryName},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="source != null">#{source},</if>
|
|
<if test="schoolId != null">#{schoolId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateExamQuestionFavorite" parameterType="ExamQuestionFavorite">
|
|
update exam_question_favorite
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="questionId != null">question_id = #{questionId},</if>
|
|
<if test="studentId != null">student_id = #{studentId},</if>
|
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
|
<if test="categoryName != null">category_name = #{categoryName},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="source != null">source = #{source},</if>
|
|
<if test="schoolId != null">school_id = #{schoolId},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteExamQuestionFavoriteById" parameterType="Long">
|
|
delete from exam_question_favorite where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteExamQuestionFavoriteByIds" parameterType="String">
|
|
delete from exam_question_favorite where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |