<?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.eme.mapper.BusiTeamInfoMapper">
    <resultMap type="com.goldenwater.slaj.eme.domain.BusiTeamInfo" id="BusiTeamInfoResult">
        <result property="guid" column="guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="teamType" column="team_type"/>
        <result property="teamName" column="team_name"/>
        <result property="chieTeam" column="chie_team"/>
        <result property="teamNum" column="team_num"/>
        <result property="teamTel" column="team_tel"/>
        <result property="trainCont" column="train_cont"/>
        <result property="equiInfo" column="equi_info"/>
        <result property="teamResp" column="team_resp"/>
        <result property="teamCode" column="team_code"/>
        <result property="supGuid" column="sup_guid"/>
        <result property="note" column="note"/>
    </resultMap>
    <sql id="selectBusiTeamInfoVo">
        select guid, org_guid, team_type, team_name, chie_team, team_num,
               team_tel, train_cont, equi_info, team_resp, team_code, sup_guid, note
        from t_busi_team_info
    </sql>
    <select id="selectBusiTeamInfoByGuid" parameterType="String" resultMap="BusiTeamInfoResult">
        <include refid="selectBusiTeamInfoVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBusiTeamInfoList" parameterType="com.goldenwater.slaj.eme.domain.BusiTeamInfo" resultMap="BusiTeamInfoResult">
        <include refid="selectBusiTeamInfoVo"/>
        <where>
            <if test="teamName != null and teamName != ''">AND team_name like concat('%', #{teamName}, '%')</if>
            <if test="teamType != null and teamType != ''">AND team_type = #{teamType}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
        </where>
    </select>
    <insert id="insertBusiTeamInfo" parameterType="com.goldenwater.slaj.eme.domain.BusiTeamInfo">
        insert into t_busi_team_info (
            guid, org_guid, team_type, team_name, chie_team, team_num,
            team_tel, train_cont, equi_info, team_resp, team_code, sup_guid, note
        ) values (
            #{guid}, #{orgGuid}, #{teamType}, #{teamName}, #{chieTeam}, #{teamNum},
            #{teamTel}, #{trainCont}, #{equiInfo}, #{teamResp}, #{teamCode}, #{supGuid}, #{note}
        )
    </insert>
    <update id="updateBusiTeamInfo" parameterType="com.goldenwater.slaj.eme.domain.BusiTeamInfo">
        update t_busi_team_info
        <set>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="teamType != null">team_type = #{teamType},</if>
            <if test="teamName != null">team_name = #{teamName},</if>
            <if test="chieTeam != null">chie_team = #{chieTeam},</if>
            <if test="teamNum != null">team_num = #{teamNum},</if>
            <if test="teamTel != null">team_tel = #{teamTel},</if>
            <if test="trainCont != null">train_cont = #{trainCont},</if>
            <if test="equiInfo != null">equi_info = #{equiInfo},</if>
            <if test="teamResp != null">team_resp = #{teamResp},</if>
            <if test="teamCode != null">team_code = #{teamCode},</if>
            <if test="supGuid != null">sup_guid = #{supGuid},</if>
            <if test="note != null">note = #{note},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteBusiTeamInfoByGuid" parameterType="String">
        delete from t_busi_team_info where guid = #{guid}
    </delete>
    <delete id="deleteBusiTeamInfoByGuids" parameterType="String">
        delete from t_busi_team_info where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
