TContractorTrainCourseTopicMapper.xml 4.4 KB
Newer Older
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
<?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.zehong.system.mapper.TContractorTrainCourseTopicMapper">
    
    <resultMap type="TContractorTrainCourseTopic" id="TContractorTrainCourseTopicResult">
        <result property="topicId"    column="topic_id"    />
        <result property="contractorCourseId"    column="contractor_course_id"    />
        <result property="topicTitle"    column="topic_title"    />
        <result property="topicOption"    column="topic_option"    />
        <result property="answer"    column="answer"    />
        <result property="createTime"    column="create_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTContractorTrainCourseTopicVo">
        select topic_id, contractor_course_id, topic_title, topic_option, answer, create_time, is_del, remark from t_contractor_train_course_topic
    </sql>

    <select id="selectTContractorTrainCourseTopicList" parameterType="TContractorTrainCourseTopic" resultMap="TContractorTrainCourseTopicResult">
        <include refid="selectTContractorTrainCourseTopicVo"/>
        <where>  
            <if test="contractorCourseId != null "> and contractor_course_id = #{contractorCourseId}</if>
            <if test="topicTitle != null  and topicTitle != ''"> and topic_title = #{topicTitle}</if>
            <if test="topicOption != null  and topicOption != ''"> and topic_option = #{topicOption}</if>
            <if test="answer != null "> and answer = #{answer}</if>
            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
        </where>
    </select>
    
    <select id="selectTContractorTrainCourseTopicById" parameterType="Long" resultMap="TContractorTrainCourseTopicResult">
        <include refid="selectTContractorTrainCourseTopicVo"/>
        where topic_id = #{topicId}
    </select>
        
    <insert id="insertTContractorTrainCourseTopic" parameterType="TContractorTrainCourseTopic" useGeneratedKeys="true" keyProperty="topicId">
        insert into t_contractor_train_course_topic
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="contractorCourseId != null">contractor_course_id,</if>
            <if test="topicTitle != null">topic_title,</if>
            <if test="topicOption != null">topic_option,</if>
            <if test="answer != null">answer,</if>
            <if test="createTime != null">create_time,</if>
            <if test="isDel != null">is_del,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="contractorCourseId != null">#{contractorCourseId},</if>
            <if test="topicTitle != null">#{topicTitle},</if>
            <if test="topicOption != null">#{topicOption},</if>
            <if test="answer != null">#{answer},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTContractorTrainCourseTopic" parameterType="TContractorTrainCourseTopic">
        update t_contractor_train_course_topic
        <trim prefix="SET" suffixOverrides=",">
            <if test="contractorCourseId != null">contractor_course_id = #{contractorCourseId},</if>
            <if test="topicTitle != null">topic_title = #{topicTitle},</if>
            <if test="topicOption != null">topic_option = #{topicOption},</if>
            <if test="answer != null">answer = #{answer},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where topic_id = #{topicId}
    </update>

    <delete id="deleteTContractorTrainCourseTopicById" parameterType="Long">
        delete from t_contractor_train_course_topic where topic_id = #{topicId}
    </delete>

    <delete id="deleteTContractorTrainCourseTopicByIds" parameterType="String">
        delete from t_contractor_train_course_topic where topic_id in 
        <foreach item="topicId" collection="array" open="(" separator="," close=")">
            #{topicId}
        </foreach>
    </delete>
</mapper>