<?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.xunmei.system.mapper.SysOrgExtendMapper">

    <resultMap type="com.xunmei.system.domain.SysOrgExtend" id="SysOrgExtendResult">
                <result property="id" column="id"/>
                <result property="orgType" column="org_type"/>
                <result property="weatherAreaCode" column="weather_area_code"/>
                <result property="premisesArea" column="premises_area"/>
                <result property="ownership" column="ownership"/>
                <result property="outsideArea" column="outside_area"/>
                <result property="orgPhysicalDefenseConstructionId" column="org_physical_defense_construction_id"/>
                <result property="askari" column="askari"/>
                <result property="askariCertificate" column="askari_certificate"/>
                <result property="businessLibraryType" column="business_library
_type"/>
                <result property="dutyMode" column="duty_mode"/>
                <result property="remoteControl" column="remote_control"/>
                <result property="selfServiceBank" column="self_service_bank"/>
                <result property="lobbyEquipment" column="lobby_equipment"/>
                <result property="wallPenetratingEquipment" column="wall_penetrating_equipment"/>
                <result property="bankPhysicalDefenseConstructionId" column="bank_physical_defense_construction_id"/>
                <result property="createTime" column="create_time"/>
                <result property="updateTime" column="update_time"/>
                <result property="createBy" column="create_by"/>
                <result property="updateBy" column="update_by"/>
                <result property="orgId" column="org_id"/>
    </resultMap>

    <sql id="selectSysOrgExtendVo">
        select id, org_type, weather_area_code, premises_area, ownership, outside_area, org_physical_defense_construction_id, askari, askari_certificate, business_library
_type, duty_mode, remote_control, self_service_bank, lobby_equipment, wall_penetrating_equipment, bank_physical_defense_construction_id, create_time, update_time, create_by, update_by, org_id
        from sys_org_extend
    </sql>

    <select id="selectSysOrgExtendList" parameterType="com.xunmei.system.domain.SysOrgExtend"
            resultMap="SysOrgExtendResult">
        <include refid="selectSysOrgExtendVo"/>
        <where>
                        <if test="orgType != null ">
                            and org_type = #{orgType}
                        </if>
                        <if test="weatherAreaCode != null  and weatherAreaCode != ''">
                            and weather_area_code = #{weatherAreaCode}
                        </if>
                        <if test="premisesArea != null ">
                            and premises_area = #{premisesArea}
                        </if>
                        <if test="ownership != null ">
                            and ownership = #{ownership}
                        </if>
                        <if test="outsideArea != null ">
                            and outside_area = #{outsideArea}
                        </if>
                        <if test="orgPhysicalDefenseConstructionId != null ">
                            and org_physical_defense_construction_id = #{orgPhysicalDefenseConstructionId}
                        </if>
                        <if test="askari != null ">
                            and askari = #{askari}
                        </if>
                        <if test="askariCertificate != null  and askariCertificate != ''">
                            and askari_certificate = #{askariCertificate}
                        </if>
                        <if test="businessLibrary
Type != null ">
                            and business_library
_type = #{businessLibrary
Type}
                        </if>
                        <if test="dutyMode != null ">
                            and duty_mode = #{dutyMode}
                        </if>
                        <if test="remoteControl != null ">
                            and remote_control = #{remoteControl}
                        </if>
                        <if test="selfServiceBank != null ">
                            and self_service_bank = #{selfServiceBank}
                        </if>
                        <if test="lobbyEquipment != null ">
                            and lobby_equipment = #{lobbyEquipment}
                        </if>
                        <if test="wallPenetratingEquipment != null ">
                            and wall_penetrating_equipment = #{wallPenetratingEquipment}
                        </if>
                        <if test="bankPhysicalDefenseConstructionId != null ">
                            and bank_physical_defense_construction_id = #{bankPhysicalDefenseConstructionId}
                        </if>
                        <if test="orgId != null ">
                            and org_id = #{orgId}
                        </if>
        </where>
    </select>

    <select id="selectSysOrgExtendById" parameterType="Long"
            resultMap="SysOrgExtendResult">
            <include refid="selectSysOrgExtendVo"/>
            where id = #{id}
    </select>

    <insert id="insertSysOrgExtend" parameterType="com.xunmei.system.domain.SysOrgExtend"            useGeneratedKeys="true" keyProperty="id">
        insert into sys_org_extend
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="orgType != null">org_type,
                    </if>
                    <if test="weatherAreaCode != null">weather_area_code,
                    </if>
                    <if test="premisesArea != null">premises_area,
                    </if>
                    <if test="ownership != null">ownership,
                    </if>
                    <if test="outsideArea != null">outside_area,
                    </if>
                    <if test="orgPhysicalDefenseConstructionId != null">org_physical_defense_construction_id,
                    </if>
                    <if test="askari != null">askari,
                    </if>
                    <if test="askariCertificate != null">askari_certificate,
                    </if>
                    <if test="businessLibrary
Type != null">business_library
_type,
                    </if>
                    <if test="dutyMode != null">duty_mode,
                    </if>
                    <if test="remoteControl != null">remote_control,
                    </if>
                    <if test="selfServiceBank != null">self_service_bank,
                    </if>
                    <if test="lobbyEquipment != null">lobby_equipment,
                    </if>
                    <if test="wallPenetratingEquipment != null">wall_penetrating_equipment,
                    </if>
                    <if test="bankPhysicalDefenseConstructionId != null">bank_physical_defense_construction_id,
                    </if>
                    <if test="createTime != null">create_time,
                    </if>
                    <if test="updateTime != null">update_time,
                    </if>
                    <if test="createBy != null">create_by,
                    </if>
                    <if test="updateBy != null">update_by,
                    </if>
                    <if test="orgId != null">org_id,
                    </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="orgType != null">#{orgType},
                    </if>
                    <if test="weatherAreaCode != null">#{weatherAreaCode},
                    </if>
                    <if test="premisesArea != null">#{premisesArea},
                    </if>
                    <if test="ownership != null">#{ownership},
                    </if>
                    <if test="outsideArea != null">#{outsideArea},
                    </if>
                    <if test="orgPhysicalDefenseConstructionId != null">#{orgPhysicalDefenseConstructionId},
                    </if>
                    <if test="askari != null">#{askari},
                    </if>
                    <if test="askariCertificate != null">#{askariCertificate},
                    </if>
                    <if test="businessLibrary
Type != null">#{businessLibrary
Type},
                    </if>
                    <if test="dutyMode != null">#{dutyMode},
                    </if>
                    <if test="remoteControl != null">#{remoteControl},
                    </if>
                    <if test="selfServiceBank != null">#{selfServiceBank},
                    </if>
                    <if test="lobbyEquipment != null">#{lobbyEquipment},
                    </if>
                    <if test="wallPenetratingEquipment != null">#{wallPenetratingEquipment},
                    </if>
                    <if test="bankPhysicalDefenseConstructionId != null">#{bankPhysicalDefenseConstructionId},
                    </if>
                    <if test="createTime != null">#{createTime},
                    </if>
                    <if test="updateTime != null">#{updateTime},
                    </if>
                    <if test="createBy != null">#{createBy},
                    </if>
                    <if test="updateBy != null">#{updateBy},
                    </if>
                    <if test="orgId != null">#{orgId},
                    </if>
        </trim>
    </insert>

    <update id="updateSysOrgExtend" parameterType="com.xunmei.system.domain.SysOrgExtend">
        update sys_org_extend
        <trim prefix="SET" suffixOverrides=",">
                    <if test="orgType != null">org_type =
                        #{orgType},
                    </if>
                    <if test="weatherAreaCode != null">weather_area_code =
                        #{weatherAreaCode},
                    </if>
                    <if test="premisesArea != null">premises_area =
                        #{premisesArea},
                    </if>
                    <if test="ownership != null">ownership =
                        #{ownership},
                    </if>
                    <if test="outsideArea != null">outside_area =
                        #{outsideArea},
                    </if>
                    <if test="orgPhysicalDefenseConstructionId != null">org_physical_defense_construction_id =
                        #{orgPhysicalDefenseConstructionId},
                    </if>
                    <if test="askari != null">askari =
                        #{askari},
                    </if>
                    <if test="askariCertificate != null">askari_certificate =
                        #{askariCertificate},
                    </if>
                    <if test="businessLibrary
Type != null">business_library
_type =
                        #{businessLibrary
Type},
                    </if>
                    <if test="dutyMode != null">duty_mode =
                        #{dutyMode},
                    </if>
                    <if test="remoteControl != null">remote_control =
                        #{remoteControl},
                    </if>
                    <if test="selfServiceBank != null">self_service_bank =
                        #{selfServiceBank},
                    </if>
                    <if test="lobbyEquipment != null">lobby_equipment =
                        #{lobbyEquipment},
                    </if>
                    <if test="wallPenetratingEquipment != null">wall_penetrating_equipment =
                        #{wallPenetratingEquipment},
                    </if>
                    <if test="bankPhysicalDefenseConstructionId != null">bank_physical_defense_construction_id =
                        #{bankPhysicalDefenseConstructionId},
                    </if>
                    <if test="createTime != null">create_time =
                        #{createTime},
                    </if>
                    <if test="updateTime != null">update_time =
                        #{updateTime},
                    </if>
                    <if test="createBy != null">create_by =
                        #{createBy},
                    </if>
                    <if test="updateBy != null">update_by =
                        #{updateBy},
                    </if>
                    <if test="orgId != null">org_id =
                        #{orgId},
                    </if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysOrgExtendById" parameterType="Long">
        delete
        from sys_org_extend where id = #{id}
    </delete>

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