<?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.BisSinsScheGropMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.BisSinsScheGrop" id="BisSinsScheGropResult">
        <result property="guid" column="guid"/>
        <result property="scheGuid" column="sche_guid"/>
        <result property="groupName" column="group_name"/>
        <result property="groupLeader" column="group_leader"/>
        <result property="groupLeaderWiun" column="group_leader_wiun"/>
        <result property="scheModel" column="sche_model"/>
        <result property="schePath" column="sche_path"/>
        <result property="schePathDetl" column="sche_path_detl"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
    </resultMap>

    <sql id="selectBisSinsScheGropVo">
        select guid, sche_guid, group_name, group_leader, group_leader_wiun, sche_model, sche_path, sche_path_detl, note, coll_time, upd_time, rec_pers from bis_sins_sche_grop
    </sql>

    <select id="selectBisSinsScheGropByGuid" parameterType="String" resultMap="BisSinsScheGropResult">
        <include refid="selectBisSinsScheGropVo"/> where guid = #{guid}
    </select>

    <select id="selectBisSinsScheGropList" parameterType="com.goldenwater.slaj.sins.domain.BisSinsScheGrop" resultMap="BisSinsScheGropResult">
        <include refid="selectBisSinsScheGropVo"/>
        <where>
            <if test="scheGuid != null and scheGuid != ''">
                and sche_guid = #{scheGuid}
            </if>
            <if test="groupName != null and groupName != ''">
                and group_name like '%' || #{groupName} || '%'
            </if>
        </where>
    </select>

    <insert id="insertBisSinsScheGrop" parameterType="com.goldenwater.slaj.sins.domain.BisSinsScheGrop">
        insert into bis_sins_sche_grop (guid, sche_guid, group_name, group_leader, group_leader_wiun, sche_model, sche_path, sche_path_detl, note, coll_time, upd_time, rec_pers)
        values (#{guid}, #{scheGuid}, #{groupName}, #{groupLeader}, #{groupLeaderWiun}, #{scheModel}, #{schePath}, #{schePathDetl}, #{note}, #{collTime}, #{updTime}, #{recPers})
    </insert>

    <update id="updateBisSinsScheGrop" parameterType="com.goldenwater.slaj.sins.domain.BisSinsScheGrop">
        update bis_sins_sche_grop
        <set>
            <if test="scheGuid != null and scheGuid != ''">sche_guid = #{scheGuid},</if>
            <if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
            <if test="groupLeader != null and groupLeader != ''">group_leader = #{groupLeader},</if>
            <if test="groupLeaderWiun != null and groupLeaderWiun != ''">group_leader_wiun = #{groupLeaderWiun},</if>
            <if test="scheModel != null and scheModel != ''">sche_model = #{scheModel},</if>
            <if test="schePath != null and schePath != ''">sche_path = #{schePath},</if>
            <if test="schePathDetl != null and schePathDetl != ''">sche_path_detl = #{schePathDetl},</if>
            <if test="note != null and note != ''">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null and recPers != ''">rec_pers = #{recPers},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisSinsScheGropByGuid" parameterType="String">
        delete from bis_sins_sche_grop where guid = #{guid}
    </delete>

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