<?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.ruoyi.model.mapper.ShortAnswerQuestionsMapper">
    
    <resultMap type="ShortAnswerQuestions" id="ShortAnswerQuestionsResult">
        <result property="shortAnswerQuestionsId"    column="short_answer_questions_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="reamk"    column="reamk"    />
        <result property="shortAnswerQuestionsReply"    column="short_answer_questions_reply"    />
        <result property="shortAnswerQuestionsSolve"    column="short_answer_questions_solve"    />
        <result property="shortAnswerQuestionsTrueorfalse"    column="short_answer_questions_trueorfalse"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="userId"    column="user_id"    />
    </resultMap>

    <sql id="selectShortAnswerQuestionsVo">
        select short_answer_questions_id, create_by, create_time, del_flag, reamk, short_answer_questions_reply, short_answer_questions_solve, short_answer_questions_trueorfalse, update_by, update_time, user_id from short_answer_questions
    </sql>

    <select id="selectShortAnswerQuestionsList" parameterType="ShortAnswerQuestions" resultMap="ShortAnswerQuestionsResult">
        <include refid="selectShortAnswerQuestionsVo"/>
        <where>  
            <if test="reamk != null  and reamk != ''"> and reamk = #{reamk}</if>
            <if test="shortAnswerQuestionsReply != null  and shortAnswerQuestionsReply != ''"> and short_answer_questions_reply = #{shortAnswerQuestionsReply}</if>
            <if test="shortAnswerQuestionsSolve != null  and shortAnswerQuestionsSolve != ''"> and short_answer_questions_solve = #{shortAnswerQuestionsSolve}</if>
            <if test="shortAnswerQuestionsTrueorfalse != null "> and short_answer_questions_trueorfalse = #{shortAnswerQuestionsTrueorfalse}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
        </where>
    </select>
    
    <select id="selectShortAnswerQuestionsByShortAnswerQuestionsId" parameterType="Long" resultMap="ShortAnswerQuestionsResult">
        <include refid="selectShortAnswerQuestionsVo"/>
        where short_answer_questions_id = #{shortAnswerQuestionsId}
    </select>
    <select id="getShortAnswerQuestionsList" resultType="com.ruoyi.model.domain.ShortAnswerQuestions">
        <include refid="selectShortAnswerQuestionsVo"/>
    </select>

    <insert id="insertShortAnswerQuestions" parameterType="ShortAnswerQuestions">
        insert into short_answer_questions
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="shortAnswerQuestionsId != null">short_answer_questions_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="reamk != null">reamk,</if>
            <if test="shortAnswerQuestionsReply != null">short_answer_questions_reply,</if>
            <if test="shortAnswerQuestionsSolve != null">short_answer_questions_solve,</if>
            <if test="shortAnswerQuestionsTrueorfalse != null">short_answer_questions_trueorfalse,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="userId != null">user_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="shortAnswerQuestionsId != null">#{shortAnswerQuestionsId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="reamk != null">#{reamk},</if>
            <if test="shortAnswerQuestionsReply != null">#{shortAnswerQuestionsReply},</if>
            <if test="shortAnswerQuestionsSolve != null">#{shortAnswerQuestionsSolve},</if>
            <if test="shortAnswerQuestionsTrueorfalse != null">#{shortAnswerQuestionsTrueorfalse},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="userId != null">#{userId},</if>
         </trim>
    </insert>

    <update id="updateShortAnswerQuestions" parameterType="ShortAnswerQuestions">
        update short_answer_questions
        <trim prefix="SET" suffixOverrides=",">
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="reamk != null">reamk = #{reamk},</if>
            <if test="shortAnswerQuestionsReply != null">short_answer_questions_reply = #{shortAnswerQuestionsReply},</if>
            <if test="shortAnswerQuestionsSolve != null">short_answer_questions_solve = #{shortAnswerQuestionsSolve},</if>
            <if test="shortAnswerQuestionsTrueorfalse != null">short_answer_questions_trueorfalse = #{shortAnswerQuestionsTrueorfalse},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="userId != null">user_id = #{userId},</if>
        </trim>
        where short_answer_questions_id = #{shortAnswerQuestionsId}
    </update>

    <delete id="deleteShortAnswerQuestionsByShortAnswerQuestionsId" parameterType="Long">
        delete from short_answer_questions where short_answer_questions_id = #{shortAnswerQuestionsId}
    </delete>

    <delete id="deleteShortAnswerQuestionsByShortAnswerQuestionsIds" parameterType="String">
        delete from short_answer_questions where short_answer_questions_id in 
        <foreach item="shortAnswerQuestionsId" collection="array" open="(" separator="," close=")">
            #{shortAnswerQuestionsId}
        </foreach>
    </delete>
</mapper>