龚焕茏
2024-07-03 3ec909b27b3eba956aa9d00cc7a94c179bd04bbf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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.mindskip.xzs.repository.ExamTemplatesQuestionMapper">
    <resultMap id="BaseResultMap" type="com.mindskip.xzs.domain.ExamTemplatesQuestion">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="label" jdbcType="VARCHAR" property="label"/>
        <result column="multiple_choice" jdbcType="VARCHAR" property="multipleChoice"/>
        <result column="single_choice" jdbcType="VARCHAR" property="singleChoice"/>
        <result column="true_false" jdbcType="VARCHAR" property="trueFalse"/>
        <result column="templates_id" jdbcType="INTEGER" property="templatesId"/>
        <result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        id, label, multiple_choice, single_choice, true_false, templates_id, subject_id
    </sql>
 
    <insert id="add" parameterType="com.mindskip.xzs.domain.ExamTemplatesQuestion" useGeneratedKeys="true" keyProperty="id">
        insert into t_exam_templates_question (label, multiple_choice, single_choice, true_false, templates_id, subject_id)
        values (#{label}, #{multipleChoice}, #{singleChoice}, #{trueFalse}, #{templatesId}, #{subjectId})
    </insert>
 
    <select id="getTemplatesId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_exam_templates_question
        where templates_id = #{templatesId}
    </select>
 
    <insert id="saves" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        insert into t_exam_templates_question(id, label, multiple_choice, single_choice, true_false, templates_id, subject_id)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.id},#{item.label},#{item.multipleChoice},#{item.singleChoice},#{item.trueFalse},#{item.templatesId}, #{item.subjectId})
        </foreach>
    </insert>
 
    <delete id="removeByTemplatesId" parameterType="java.lang.Integer">
        delete from t_exam_templates_question
        where templates_id = #{templatesId}
    </delete>
 
    <select id="getByTemplatesId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_exam_templates_question where templates_id = #{templatesId}
    </select>
 
 
 
</mapper>