<?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.usky.fire.mapper.DemEnforceReportAttachMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.usky.fire.domain.DemEnforceReportAttach">
        <id column="id" property="id"/>
        <result column="report_id" property="reportId"/>
        <result column="serial_number" property="serialNumber"/>
        <result column="operator" property="operator"/>
        <result column="operator_phone" property="operatorPhone"/>
        <result column="complete_time" property="completeTime"/>
        <result column="complete_submit_time" property="completeSubmitTime"/>
        <result column="data_entry_time" property="dataEntryTime"/>
        <result column="annex_id" property="annexId"/>
        <result column="report_status" property="reportStatus"/>
        <result column="follow_up_status" property="followUpStatus"/>
        <result column="order_receive_time" property="orderReceiveTime"/>
        <result column="detachment_receive_time" property="detachmentReceiveTime"/>
        <result column="brigade_receive_time" property="brigadeReceiveTime"/>
        <result column="command_center_receiver" property="commandCenterReceiver"/>
        <result column="detachment_receiver" property="detachmentReceiver"/>
        <result column="brigade_receiver" property="brigadeReceiver"/>
        <result column="fire_control_id" property="fireControlId"/>
        <result column="switchboard_phone_id" property="switchboardPhoneId"/>
        <result column="process_table_id" property="processTableId"/>
        <result column="process_instance_id" property="processInstanceId"/>
        <result column="filing_time" property="filingTime"/>
        <result column="filing_person" property="filingPerson"/>
        <result column="report_area" property="reportArea"/>
        <result column="supervision_times" property="supervisionTimes"/>
        <result column="bonus_payment_status" property="bonusPaymentStatus"/>
        <result column="detachment_rollback_reason" property="detachmentRollbackReason"/>
        <result column="detachment_rollback_time" property="detachmentRollbackTime"/>
        <result column="report_attachment" property="reportAttachment"/>
        <result column="no_contact_other" property="noContactOther"/>
        <result column="hazard_site_other" property="hazardSiteOther"/>
        <result column="hazard_type_other" property="hazardTypeOther"/>
        <result column="complete_attachment" property="completeAttachment"/>
        <result column="cancelled_time" property="cancelledTime"/>
        <result column="cancelled_person" property="cancelledPerson"/>
        <result column="bonus_application_id" property="bonusApplicationId"/>
        <result column="detachment_receiver_name" property="detachmentReceiverName"/>
        <result column="brigade_filed_return" property="brigadeFiledReturn"/>
        <result column="need_feedback" property="needFeedback"/>
        <result column="feedback_time" property="feedbackTime"/>
        <result column="feedback_deadline" property="feedbackDeadline"/>
        <result column="feedback_content" property="feedbackContent"/>
        <result column="bdp_audit" property="bdpAudit"/>
        <result column="work_order_status_name" property="workOrderStatusName"/>
        <result column="report_method_name" property="reportMethodName"/>
        <result column="govern_area_name" property="governAreaName"/>
        <result column="hazard_site_name" property="hazardSiteName"/>
        <result column="hazard_type_name" property="hazardTypeName"/>
        <result column="work_order_type_name" property="workOrderTypeName"/>
        <result column="union_key" property="unionKey"/>
    </resultMap>

    <select id="selectCount1" resultType="java.lang.Integer">
        select count(*) from
        dem_enforce_report_complaint as a
        JOIN dem_enforce_report_attach as b ON a.report_id = b.report_id
        <where>
            a.`enable` = 0
            AND b.work_order_status_name != '已撤销'
            <if test="workOrderStatusName !=null and workOrderStatusName != ''">
                and b.work_order_status_name = #{workOrderStatusName}
            </if>
            <if test="satisfiedType !=null and satisfiedType != ''">
                and a.satisfied_type = #{satisfiedType}
            </if>
        </where>
    </select>

</mapper>
