<?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.sins.mapper.RelSblzConfigMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.RelSblzConfig" id="RelSblzConfigResult">
        <result property="guid" column="guid"/>
        <result property="scheGuid" column="sche_guid"/>
        <result property="expertGuid" column="expert_guid"/>
        <result property="configInfo" column="config_info"/>
        <result property="fromDate" column="from_date"/>
        <result property="toDate" column="to_date"/>
        <result property="groupGuid" column="group_guid"/>
        <result property="leaderOrgGuid" column="leader_org_guid"/>
    </resultMap>

    <sql id="selectRelSblzConfigVo">
        select guid, sche_guid, expert_guid, config_info, from_date, to_date, group_guid, leader_org_guid from rel_sblz_config
    </sql>

    <select id="selectRelSblzConfigByGuid" parameterType="String" resultMap="RelSblzConfigResult">
        <include refid="selectRelSblzConfigVo"/> where guid = #{guid}
    </select>

    <select id="selectRelSblzConfigList" parameterType="com.goldenwater.slaj.sins.domain.RelSblzConfig" resultMap="RelSblzConfigResult">
        <include refid="selectRelSblzConfigVo"/>
        <where>
            <if test="scheGuid != null and scheGuid != ''">
                and sche_guid = #{scheGuid}
            </if>
            <if test="groupGuid != null and groupGuid != ''">
                and group_guid = #{groupGuid}
            </if>
        </where>
    </select>

    <insert id="insertRelSblzConfig" parameterType="com.goldenwater.slaj.sins.domain.RelSblzConfig">
        insert into rel_sblz_config (guid, sche_guid, expert_guid, config_info, from_date, to_date, group_guid, leader_org_guid)
        values (#{guid}, #{scheGuid}, #{expertGuid}, #{configInfo}, #{fromDate}, #{toDate}, #{groupGuid}, #{leaderOrgGuid})
    </insert>

    <update id="updateRelSblzConfig" parameterType="com.goldenwater.slaj.sins.domain.RelSblzConfig">
        update rel_sblz_config
        <set>
            <if test="scheGuid != null and scheGuid != ''">sche_guid = #{scheGuid},</if>
            <if test="expertGuid != null and expertGuid != ''">expert_guid = #{expertGuid},</if>
            <if test="configInfo != null and configInfo != ''">config_info = #{configInfo},</if>
            <if test="fromDate != null">from_date = #{fromDate},</if>
            <if test="toDate != null">to_date = #{toDate},</if>
            <if test="groupGuid != null and groupGuid != ''">group_guid = #{groupGuid},</if>
            <if test="leaderOrgGuid != null and leaderOrgGuid != ''">leader_org_guid = #{leaderOrgGuid},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteRelSblzConfigByGuid" parameterType="String">
        delete from rel_sblz_config where guid = #{guid}
    </delete>

    <delete id="deleteRelSblzConfigByGuids" parameterType="String">
        delete from rel_sblz_config where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">#{guid}</foreach>
    </delete>
</mapper>
