123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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="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 create_time desc
- </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>
- </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>
- </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
- )
- 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}
- )
- </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>
- </mapper>
|