<?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.ruoyi.zongzhi.mapper.TcExtworkSafetyadminMapper">
    
    <resultMap type="TcExtworkSafetyadmin" id="TcExtworkSafetyadminResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="unit"    column="unit"    />
        <result property="firstPrincipal"    column="first_principal"    />
        <result property="duty"    column="duty"    />
        <result property="directPrincipal"    column="direct_principal"    />
        <result property="duty1"    column="duty1"    />
        <result property="fuzeKeshi"    column="fuze_keshi"    />
        <result property="networkAqg"    column="network_aqg"    />
        <result property="duty2"    column="duty2"    />
        <result property="tel"    column="tel"    />
        <result property="createId"    column="create_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateId"    column="update_id"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="isStatus"    column="is_status"    />
    </resultMap>

    <sql id="selectTcExtworkSafetyadminVo">
        select id, area_id, unit, is_status,first_principal, duty, direct_principal, duty1, fuze_keshi, network_aqg, duty2, tel, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_extwork_safetyadmin
    </sql>

    <select id="selectTcExtworkSafetyadminList" parameterType="TcExtworkSafetyadmin" resultMap="TcExtworkSafetyadminResult">
        <include refid="selectTcExtworkSafetyadminVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
            <if test="firstPrincipal != null  and firstPrincipal != ''"> and first_principal = #{firstPrincipal}</if>
            <if test="duty != null  and duty != ''"> and duty = #{duty}</if>
            <if test="directPrincipal != null  and directPrincipal != ''"> and direct_principal = #{directPrincipal}</if>
            <if test="duty1 != null  and duty1 != ''"> and duty1 = #{duty1}</if>
            <if test="fuzeKeshi != null  and fuzeKeshi != ''"> and fuze_keshi = #{fuzeKeshi}</if>
            <if test="networkAqg != null  and networkAqg != ''"> and network_aqg = #{networkAqg}</if>
            <if test="duty2 != null  and duty2 != ''"> and duty2 = #{duty2}</if>
            <if test="tel != null  and tel != ''"> and tel = #{tel}</if>
            <if test="createId != null "> and create_id = #{createId}</if>
            <if test="updateId != null "> and update_id = #{updateId}</if>
            <if test="isStatus != null "> and is_status = #{isStatus}</if>
        </where>
    </select>
    
    <select id="selectTcExtworkSafetyadminById" parameterType="Long" resultMap="TcExtworkSafetyadminResult">
        <include refid="selectTcExtworkSafetyadminVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcExtworkSafetyadmin" parameterType="TcExtworkSafetyadmin">
        insert into tc_extwork_safetyadmin
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="areaId != null">area_id,</if>
            <if test="unit != null">unit,</if>
            <if test="firstPrincipal != null">first_principal,</if>
            <if test="duty != null">duty,</if>
            <if test="directPrincipal != null">direct_principal,</if>
            <if test="duty1 != null">duty1,</if>
            <if test="fuzeKeshi != null">fuze_keshi,</if>
            <if test="networkAqg != null">network_aqg,</if>
            <if test="duty2 != null">duty2,</if>
            <if test="tel != null">tel,</if>
            <if test="createId != null">create_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateId != null">update_id,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="isStatus != null">is_status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="areaId != null">#{areaId},</if>
            <if test="unit != null">#{unit},</if>
            <if test="firstPrincipal != null">#{firstPrincipal},</if>
            <if test="duty != null">#{duty},</if>
            <if test="directPrincipal != null">#{directPrincipal},</if>
            <if test="duty1 != null">#{duty1},</if>
            <if test="fuzeKeshi != null">#{fuzeKeshi},</if>
            <if test="networkAqg != null">#{networkAqg},</if>
            <if test="duty2 != null">#{duty2},</if>
            <if test="tel != null">#{tel},</if>
            <if test="createId != null">#{createId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateId != null">#{updateId},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="isStatus != null">#{isStatus},</if>
         </trim>
    </insert>

    <update id="updateTcExtworkSafetyadmin" parameterType="TcExtworkSafetyadmin">
        update tc_extwork_safetyadmin
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="unit != null">unit = #{unit},</if>
            <if test="firstPrincipal != null">first_principal = #{firstPrincipal},</if>
            <if test="duty != null">duty = #{duty},</if>
            <if test="directPrincipal != null">direct_principal = #{directPrincipal},</if>
            <if test="duty1 != null">duty1 = #{duty1},</if>
            <if test="fuzeKeshi != null">fuze_keshi = #{fuzeKeshi},</if>
            <if test="networkAqg != null">network_aqg = #{networkAqg},</if>
            <if test="duty2 != null">duty2 = #{duty2},</if>
            <if test="tel != null">tel = #{tel},</if>
            <if test="createId != null">create_id = #{createId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateId != null">update_id = #{updateId},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="isStatus != null">is_status=#{isStatus},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcExtworkSafetyadminById" parameterType="Long">
        delete from tc_extwork_safetyadmin where id = #{id}
    </delete>

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