<?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.goldenwater.slaj.eutr.mapper.BisEutrSubjectOfCourMapper">
    <resultMap type="com.goldenwater.slaj.eutr.domain.BisEutrSubjectOfCour" id="BisEutrSubjectOfCourResult">
        <result property="guid" column="guid"/>
        <result property="courGuid" column="cour_guid"/>
        <result property="subjGuid" column="subj_guid"/>
        <result property="subjName" column="subj_name"/>
        <result property="sort" column="sort"/>
        <result property="note" column="note"/>
    </resultMap>
    <sql id="selectBisEutrSubjectOfCourVo">
        select guid, cour_guid, subj_guid, subj_name, sort, note
        from bis_eutr_subject_of_cour
    </sql>
    <select id="selectBisEutrSubjectOfCourByGuid" parameterType="String" resultMap="BisEutrSubjectOfCourResult">
        <include refid="selectBisEutrSubjectOfCourVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBisEutrSubjectOfCourList" parameterType="com.goldenwater.slaj.eutr.domain.BisEutrSubjectOfCour" resultMap="BisEutrSubjectOfCourResult">
        <include refid="selectBisEutrSubjectOfCourVo"/>
        <where>
            <if test="courGuid != null and courGuid != ''">AND cour_guid = #{courGuid}</if>
        </where>
        order by sort
    </select>
    <insert id="insertBisEutrSubjectOfCour" parameterType="com.goldenwater.slaj.eutr.domain.BisEutrSubjectOfCour">
        insert into bis_eutr_subject_of_cour (
            guid, cour_guid, subj_guid, subj_name, sort, note
        ) values (
            #{guid}, #{courGuid}, #{subjGuid}, #{subjName}, #{sort}, #{note}
        )
    </insert>
    <update id="updateBisEutrSubjectOfCour" parameterType="com.goldenwater.slaj.eutr.domain.BisEutrSubjectOfCour">
        update bis_eutr_subject_of_cour
        <set>
            <if test="courGuid != null">cour_guid = #{courGuid},</if>
            <if test="subjGuid != null">subj_guid = #{subjGuid},</if>
            <if test="subjName != null">subj_name = #{subjName},</if>
            <if test="sort != null">sort = #{sort},</if>
            <if test="note != null">note = #{note},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteBisEutrSubjectOfCourByGuid" parameterType="String">
        delete from bis_eutr_subject_of_cour where guid = #{guid}
    </delete>
    <delete id="deleteBisEutrSubjectOfCourByGuids" parameterType="String">
        delete from bis_eutr_subject_of_cour where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
