<?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.project.zcustom.mapper.post.PlatPostStationMapper">
    
    <resultMap type="PlatPostStation" id="PlatPostStationResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="appOrg"    column="app_org"    />
        <result property="faultWarrantyNum"    column="fault_warranty_num"    />
        <result property="dispatchedNum"    column="dispatched_num"    />
        <result property="suggestedNum"    column="suggested_num"    />
        <result property="repairOrdersNum"    column="repair_orders_num"    />
        <result property="questionnairesNum"    column="questionnaires_num"    />
        <result property="fireControlNum"    column="fire_control_num"    />
        <result property="elevatorNum"    column="elevator_num"    />
        <result property="lampNum"    column="lamp_num"    />
        <result property="securityNum"    column="security_num"    />
        <result property="toiletNum"    column="toilet_num"    />
        <result property="areaNum"    column="area_num"    />
        <result property="conditionerNum"    column="conditioner_num"    />
        <result property="repairsNum"    column="repairs_num"    />
        <result property="meetingNum"    column="meeting_num"    />
        <result property="officeNum"    column="office_num"    />
    </resultMap>

    <sql id="selectPlatPostStationVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, fault_warranty_num, dispatched_num, suggested_num, repair_orders_num, questionnaires_num, fire_control_num, elevator_num, lamp_num, security_num, toilet_num, area_num, conditioner_num, repairs_num, meeting_num, office_num from large_plat_post_station
    </sql>

    <select id="selectPlatPostStationList" parameterType="PlatPostStation" resultMap="PlatPostStationResult">
        <include refid="selectPlatPostStationVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="faultWarrantyNum != null "> and fault_warranty_num = #{faultWarrantyNum}</if>
            <if test="dispatchedNum != null "> and dispatched_num = #{dispatchedNum}</if>
            <if test="suggestedNum != null "> and suggested_num = #{suggestedNum}</if>
            <if test="repairOrdersNum != null "> and repair_orders_num = #{repairOrdersNum}</if>
            <if test="questionnairesNum != null "> and questionnaires_num = #{questionnairesNum}</if>
            <if test="fireControlNum != null "> and fire_control_num = #{fireControlNum}</if>
            <if test="elevatorNum != null "> and elevator_num = #{elevatorNum}</if>
            <if test="lampNum != null "> and lamp_num = #{lampNum}</if>
            <if test="securityNum != null "> and security_num = #{securityNum}</if>
            <if test="toiletNum != null "> and toilet_num = #{toiletNum}</if>
            <if test="areaNum != null "> and area_num = #{areaNum}</if>
            <if test="conditionerNum != null "> and conditioner_num = #{conditionerNum}</if>
            <if test="repairsNum != null "> and repairs_num = #{repairsNum}</if>
            <if test="meetingNum != null "> and meeting_num = #{meetingNum}</if>
            <if test="officeNum != null "> and office_num = #{officeNum}</if>
        </where>
    </select>
    
    <select id="selectPlatPostStationById" parameterType="Long" resultMap="PlatPostStationResult">
        <include refid="selectPlatPostStationVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatPostStation" parameterType="PlatPostStation" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_post_station
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="appOrg != null">app_org,</if>
            <if test="faultWarrantyNum != null">fault_warranty_num,</if>
            <if test="dispatchedNum != null">dispatched_num,</if>
            <if test="suggestedNum != null">suggested_num,</if>
            <if test="repairOrdersNum != null">repair_orders_num,</if>
            <if test="questionnairesNum != null">questionnaires_num,</if>
            <if test="fireControlNum != null">fire_control_num,</if>
            <if test="elevatorNum != null">elevator_num,</if>
            <if test="lampNum != null">lamp_num,</if>
            <if test="securityNum != null">security_num,</if>
            <if test="toiletNum != null">toilet_num,</if>
            <if test="areaNum != null">area_num,</if>
            <if test="conditionerNum != null">conditioner_num,</if>
            <if test="repairsNum != null">repairs_num,</if>
            <if test="meetingNum != null">meeting_num,</if>
            <if test="officeNum != null">office_num,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="appOrg != null">#{appOrg},</if>
            <if test="faultWarrantyNum != null">#{faultWarrantyNum},</if>
            <if test="dispatchedNum != null">#{dispatchedNum},</if>
            <if test="suggestedNum != null">#{suggestedNum},</if>
            <if test="repairOrdersNum != null">#{repairOrdersNum},</if>
            <if test="questionnairesNum != null">#{questionnairesNum},</if>
            <if test="fireControlNum != null">#{fireControlNum},</if>
            <if test="elevatorNum != null">#{elevatorNum},</if>
            <if test="lampNum != null">#{lampNum},</if>
            <if test="securityNum != null">#{securityNum},</if>
            <if test="toiletNum != null">#{toiletNum},</if>
            <if test="areaNum != null">#{areaNum},</if>
            <if test="conditionerNum != null">#{conditionerNum},</if>
            <if test="repairsNum != null">#{repairsNum},</if>
            <if test="meetingNum != null">#{meetingNum},</if>
            <if test="officeNum != null">#{officeNum},</if>
         </trim>
    </insert>

    <update id="updatePlatPostStation" parameterType="PlatPostStation">
        update large_plat_post_station
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="appOrg != null">app_org = #{appOrg},</if>
            <if test="faultWarrantyNum != null">fault_warranty_num = #{faultWarrantyNum},</if>
            <if test="dispatchedNum != null">dispatched_num = #{dispatchedNum},</if>
            <if test="suggestedNum != null">suggested_num = #{suggestedNum},</if>
            <if test="repairOrdersNum != null">repair_orders_num = #{repairOrdersNum},</if>
            <if test="questionnairesNum != null">questionnaires_num = #{questionnairesNum},</if>
            <if test="fireControlNum != null">fire_control_num = #{fireControlNum},</if>
            <if test="elevatorNum != null">elevator_num = #{elevatorNum},</if>
            <if test="lampNum != null">lamp_num = #{lampNum},</if>
            <if test="securityNum != null">security_num = #{securityNum},</if>
            <if test="toiletNum != null">toilet_num = #{toiletNum},</if>
            <if test="areaNum != null">area_num = #{areaNum},</if>
            <if test="conditionerNum != null">conditioner_num = #{conditionerNum},</if>
            <if test="repairsNum != null">repairs_num = #{repairsNum},</if>
            <if test="meetingNum != null">meeting_num = #{meetingNum},</if>
            <if test="officeNum != null">office_num = #{officeNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatPostStationById" parameterType="Long">
        delete from large_plat_post_station where id = #{id}
    </delete>

    <delete id="deletePlatPostStationByIds" parameterType="String">
        delete from large_plat_post_station where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="reallyDeleteByWrapper">
        DELETE FROM large_plat_post_station ${ew.customSqlSegment}
    </delete>
</mapper>