| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?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.fs.course.mapper.FsCourseQuestionBankMapper">
- <resultMap type="FsCourseQuestionBank" id="FsCourseQuestionBankResult">
- <result property="id" column="id" />
- <result property="title" column="title" />
- <result property="sort" column="sort" />
- <result property="type" column="type" />
- <result property="status" column="status" />
- <result property="question" column="question" />
- <result property="createTime" column="create_time" />
- <result property="answer" column="answer" />
- <result property="createBy" column="create_by" />
- <result property="questionType" column="question_type" />
- <result property="questionSubType" column="question_sub_type" />
- </resultMap>
- <sql id="selectFsCourseQuestionBankVo">
- select id, title, sort, type, status,question_type, question_sub_type, question, create_time, answer, create_by from fs_course_question_bank
- </sql>
- <select id="selectFsCourseQuestionBankList" parameterType="FsCourseQuestionBank" resultMap="FsCourseQuestionBankResult">
- <include refid="selectFsCourseQuestionBankVo"/>
- <where>
- <if test="title != null and title != ''"> and title like concat('%', #{title}, '%') </if>
- <if test="sort != null "> and sort = #{sort}</if>
- <if test="type != null "> and type = #{type}</if>
- <if test="questionType != null "> and question_type = #{questionType}</if>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="questionSubType != null "> and question_sub_type = #{questionSubType}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="question != null and question != ''"> and question = #{question}</if>
- <if test="answer != null and answer != ''"> and answer = #{answer}</if>
- </where>
- order by sort,id
- </select>
- <select id="selectFsCourseQuestionBankById" parameterType="Long" resultMap="FsCourseQuestionBankResult">
- <include refid="selectFsCourseQuestionBankVo"/>
- where id = #{id}
- </select>
- <insert id="insertFsCourseQuestionBank" parameterType="FsCourseQuestionBank" useGeneratedKeys="true" keyProperty="id">
- insert into fs_course_question_bank
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="title != null">title,</if>
- <if test="sort != null">sort,</if>
- <if test="type != null">type,</if>
- <if test="status != null">status,</if>
- <if test="question != null">question,</if>
- <if test="createTime != null">create_time,</if>
- <if test="answer != null">answer,</if>
- <if test="createBy != null">create_by,</if>
- <if test="questionType != null">question_type,</if>
- <if test="questionSubType != null">question_sub_type,</if>
- <if test="userId != null">user_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="title != null">#{title},</if>
- <if test="sort != null">#{sort},</if>
- <if test="type != null">#{type},</if>
- <if test="status != null">#{status},</if>
- <if test="question != null">#{question},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="answer != null">#{answer},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="questionType != null">#{questionType},</if>
- <if test="questionSubType != null">#{questionSubType},</if>
- <if test="userId != null">#{userId},</if>
- </trim>
- </insert>
- <insert id="insertFsCourseQuestionBankBatch">
- INSERT INTO fs_course_question_bank (
- title,
- sort,
- type,
- status,
- question,
- create_time,
- answer,
- create_by,
- question_type,
- question_sub_type,
- user_id
- )
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.title, jdbcType=VARCHAR},
- #{item.sort, jdbcType=INTEGER},
- #{item.type, jdbcType=VARCHAR},
- #{item.status, jdbcType=INTEGER},
- #{item.question, jdbcType=CLOB},
- #{item.createTime, jdbcType=TIMESTAMP},
- #{item.answer, jdbcType=CLOB},
- #{item.createBy, jdbcType=VARCHAR},
- #{item.questionType, jdbcType=VARCHAR},
- #{item.questionSubType, jdbcType=VARCHAR},
- #{item.userId, jdbcType=BIGINT}
- )
- </foreach>
- </insert>
- <update id="updateFsCourseQuestionBank" parameterType="FsCourseQuestionBank">
- update fs_course_question_bank
- <trim prefix="SET" suffixOverrides=",">
- <if test="title != null">title = #{title},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="type != null">type = #{type},</if>
- <if test="status != null">status = #{status},</if>
- <if test="question != null">question = #{question},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="answer != null">answer = #{answer},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="questionType != null">question_type = #{questionType},</if>
- <if test="questionSubType != null">question_sub_type = #{questionSubType},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteFsCourseQuestionBankById" parameterType="Long">
- delete from fs_course_question_bank where id = #{id}
- </delete>
- <delete id="deleteFsCourseQuestionBankByIds" parameterType="String">
- delete from fs_course_question_bank where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectFsCourseQuestionBankByIds" resultType="FsCourseQuestionBank">
- SELECT *
- FROM fs_course_question_bank
- WHERE id IN
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="selectFsCourseQuestionBankByTitle" resultMap="FsCourseQuestionBankResult">
- <include refid="selectFsCourseQuestionBankVo"/>
- where title = #{title}
- limit 1
- </select>
- <update id="updateFsCourseQuestionBankBatch">
- <foreach collection="list" item="item" separator=";">
- update fs_course_question_bank
- <set>
- <if test="item.sort != null">sort = #{item.sort},</if>
- <if test="item.type != null">type = #{item.type},</if>
- <if test="item.status != null">status = #{item.status},</if>
- <if test="item.question != null">question = #{item.question},</if>
- <if test="item.answer != null">answer = #{item.answer},</if>
- <if test="item.createBy != null">create_by = #{item.createBy},</if>
- <if test="item.questionType != null">question_type = #{item.questionType},</if>
- <if test="item.questionSubType != null">question_sub_type = #{item.questionSubType},</if>
- <if test="item.userId != null">user_id = #{item.userId},</if>
- </set>
- where title = #{item.title}
- </foreach>
- </update>
- </mapper>
|