<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//oos.juyouhx.com//DTD Mapper 3.0//EN" "http://oss.juyouhx.com/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.scpyun.platform.standard.jilinsscgsdp.eventTask" name="矛盾">

    <select id="getEventId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventFlowLogVo" resultType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ResEventVo">
        SELECT
            id eventId
        FROM
            jl_event_post
        WHERE
            docking_id = #{eventId}
        AND appid = #{appid}
        AND type = 'insert'
        GROUP BY id
    </select>

    <select id="getWarnDealTime" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ResEventWarningSettingVo">
            SELECT
                DATE_FORMAT( DATE_SUB( NOW(), INTERVAL CONCAT( '-', complete_days-tip_days ) DAY ), '%Y-%m-%d %H:00:00' ) earlyWarningTime,
                DATE_FORMAT( DATE_SUB( NOW(), INTERVAL CONCAT( '-', complete_days) DAY ), '%Y-%m-%d %H:00:00' ) alarmTime
            FROM
                jl_event_warning_setting
            WHERE
                event_type = #{eventType}
    </select>

    <insert id="insertEvent" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo">
        INSERT INTO jl_event_post(
            id,
            event_type,
            event_category_id,
            event_type_id,
            occurrence_time,
            city_id,
            area_id,
            street_id,
            community_id,
            garden_id,
            building_id,
            unit_id,
            floor_id,
            doorplate_id,
            event_code,
            event_source,
            address,
            dispute_description,
            reporting_name,
            reporting_unit,
            `status`,
            del_flag,
            create_by,
            create_time,
            scanning_time,
            is_early_warning,
            early_warning_time,
            alarm_time,
            is_acceptance,
            docking_id,
            type,
            appid,
            operate_type,
            data_reception_time,
            event_name,
            event_tel,
            is_involve_everyone,
            is_involve_everyone_count,
            risk_name,
            risk_level,
            complete_time
        )VALUES(
            UUID(),
            #{eventType},
            #{eventCategoryId},
            #{eventTypeId},
            #{occurrenceTime},
            #{cityCode},
            #{areaCode},
            #{streetCode},
            #{communityCode},
            #{gardenId},
            #{buildingId},
            #{unitId},
            #{floorId},
            #{doorplateId},
            #{eventCode},
            '3',
            #{address},
            #{disputeDescription},
            #{reportingName},
            #{reportingUnit},
            #{status},
            0,
            #{appid},
            NOW(),
            NOW(),
            '1',
            #{earlyWarningTime},
            #{alarmTime},
            '1',
            #{id},
            #{type},
            #{appid},
            '0',
            NOW(),
            #{eventName},
            #{eventTel},
            #{isInvolveEveryone},
            #{isInvolveEveryoneCount},
            #{riskName},
            #{riskLevel},
            #{completeTime}
        )
    </insert>

    <!-- 更新数据 -->
    <update id="updateEvent" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo">
        UPDATE jl_event
        <set>
            <if test="eventType != null and eventType != ''">
                event_type = #{eventType},
            </if>
            <if test="eventCategoryId != null and eventCategoryId != ''">
                event_category_id = #{eventCategoryId},
            </if>
            <if test="eventTypeId != null and eventTypeId != ''">
                event_type_id = #{eventTypeId},
            </if>
            <if test="occurrenceTime != null and occurrenceTime != ''">
                occurrence_time = #{occurrenceTime},
                is_early_warning = '1',
            </if>
            <if test="cityCode != null and cityCode != ''">
                city_id = #{cityCode},
            </if>
            <if test="areaCode != null and areaCode != ''">
                area_id = #{areaCode},
            </if>
            <if test="streetCode != null and streetCode != ''">
                street_id = #{streetCode},
            </if>
            <if test="communityCode != null and communityCode != ''">
                community_id = #{communityCode},
            </if>
            <if test="gardenId != null and gardenId != ''">
                garden_id = #{gardenId},
            </if>
            <if test="buildingId != null and buildingId != ''">
                building_id = #{buildingId},
            </if>
            <if test="unitId != null and unitId != ''">
                unit_id = #{unitId},
            </if>
            <if test="floorId != null and floorId != ''">
                floor_id = #{floorId},
            </if>
            <if test="doorplateId != null and doorplateId != ''">
                doorplate_id = #{doorplateId},
            </if>
            <if test="eventCode != null and eventCode != ''">
                event_code = #{eventCode},
            </if>
            <if test="eventSource != null and eventSource != ''">
                event_source = #{eventSource},
            </if>
            <if test="address != null and address != ''">
                address = #{address},
            </if>
            <if test="disputeDescription != null and disputeDescription != ''">
                dispute_description = #{disputeDescription},
            </if>
            <if test="reportingName != null and reportingName != ''">
                reporting_name = #{reportingName},
            </if>
            <if test="reportingUnit != null and reportingUnit != ''">
                reporting_unit = #{reportingUnit},
            </if>
            <if test="status != null and status != ''">
                `status` = #{status},
            </if>
            <if test="isInvolveEveryone != null and isInvolveEveryone != ''">
                is_involve_everyone = #{isInvolveEveryone},
            </if>
            <if test="isInvolveEveryoneCount != null and isInvolveEveryoneCount != ''">
                is_involve_everyone_count = #{isInvolveEveryoneCount},
            </if>
            <if test="eventName != null and eventName != ''">
                event_name = #{eventName},
            </if>
            <if test="eventTel != null and eventTel != ''">
                event_tel = #{eventTel},
            </if>
            update_by = #{appid},
            update_time = NOW(),
            scanning_time = NOW(),
            is_scanned = '0'
        </set>
        WHERE
            docking_id = #{id}
        AND appid = #{appid}
    </update>

    <insert id="insertEventLog" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventFlowLogVo">
        INSERT INTO jl_event_flow_log_post(
            id,
            docking_id,
            event_id,
            office_id,
            office_name,
            log_type,
            assignment_type,
            log_result,
            assign_result,
            risk_level,
            is_early_warning,
            resolve_way,
            resolve_process,
            resolve_name,
            resolve_unit,
            resolve_hierarchy,
            is_satisfaction,
            is_resolve,
            warning_level,
            resolve_time,
            complete_time,
            back_time,
            assign_time,
            receive_time,
            create_name,
            create_time,
            type,
            appid,
            operate_type,
            data_reception_time,
            is_dispatch_office,
            status
        )VALUES (
            UUID(),
            #{id},
            #{eventId},
            #{officeId},
            #{officeName},
            #{logType},
            #{assignmentType},
            #{logResult},
            #{assignResult},
            #{riskLevel},
            #{isEarlyWarning},
            #{resolveWay},
            #{resolveProcess},
            #{resolveName},
            #{resolveUnit},
            #{resolveHierarchy},
            #{isSatisfaction},
            #{isResolve},
            #{warningLevel},
            #{resolveTime},
            #{completeTime},
            #{backTime},
            #{assignTime},
            #{receiveTime},
            #{createName},
            #{createTime},
            #{type},
            #{appid},
            '0',
            NOW(),
            #{isDispatchOffice},
            '3'
        )
    </insert>

    <update id="updateEventLog" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventFlowLogVo">
        UPDATE jl_event_flow_log
        <set>
            <if test="eventId != null and eventId != ''">
                event_id = #{eventId},
            </if>
            <if test="officeId != null and officeId != ''">
                office_id = #{officeId},
            </if>
            <if test="officeName != null and officeName != ''">
                office_name = #{officeName},
            </if>
            <if test="logType != null and logType != ''">
                log_type = #{logType},
            </if>
            <if test="assignmentType != null and assignmentType != ''">
                assignment_type = #{assignmentType},
            </if>
            <if test="logResult != null and logResult != ''">
                log_result = #{logResult},
            </if>
            <if test="assignResult != null and assignResult != ''">
                assign_result = #{assignResult},
            </if>
            <if test="isEarlyWarning != null and isEarlyWarning != ''">
                is_early_warning = #{isEarlyWarning},
            </if>
            <if test="resolveWay != null and resolveWay != ''">
                resolve_way = #{resolveWay},
            </if>
            <if test="resolveProcess != null and resolveProcess != ''">
                resolve_process = #{resolveProcess},
            </if>
            <if test="resolveName != null and resolveName != ''">
                resolve_name = #{resolveName},
            </if>
            <if test="resolveUnit != null and resolveUnit != ''">
                resolve_unit = #{resolveUnit},
            </if>
            <if test="resolveHierarchy != null and resolveHierarchy != ''">
                resolve_hierarchy = #{resolveHierarchy},
            </if>
            <if test="isSatisfaction != null and isSatisfaction != ''">
                is_satisfaction = #{isSatisfaction},
            </if>
            <if test="isResolve != null and isResolve != ''">
                is_resolve = #{isResolve},
            </if>
            <if test="warningLevel != null and warningLevel != ''">
                warning_level = #{warningLevel},
            </if>
            <if test="resolveTime != null and resolveTime != ''">
                resolve_time = #{resolveTime},
            </if>
            <if test="completeTime != null and completeTime != ''">
                complete_time = #{completeTime},
            </if>
            <if test="backTime != null and backTime != ''">
                back_time = #{backTime},
            </if>
            <if test="assignTime != null and assignTime != ''">
                assign_time = #{assignTime},
            </if>
            <if test="receiveTime != null and receiveTime != ''">
                receive_time = #{receiveTime},
            </if>
            <if test="isDispatchOffice != null and isDispatchOffice != ''">
                is_dispatch_office = #{isDispatchOffice},
            </if>
            <if test="createName != null and createName != ''">
                create_name = #{createName},
            </if>
            <if test="createTime != null and createTime != ''">
                create_time = #{createTime}
            </if>
        </set>
        WHERE
            docking_id = #{id}
        AND appid = #{appid}
    </update>

    <!-- 更新数据 -->
    <update id="updateEventUser" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventUserVo">
        UPDATE
            jl_event_user
        SET
            <if test="eventId != null and eventId != ''">
                event_id = #{eventId},
            </if>
            <if test="eventUserType != null and eventUserType != ''">
                event_user_type = #{eventUserType},
            </if>
            <if test="eventUserName != null and eventUserName != ''">
                event_user_name = #{eventUserName},
            </if>
            <if test="eventCardType != null and eventCardType != ''">
                event_card_type = #{eventCardType},
            </if>
            <if test="eventCardno != null and eventCardno != ''">
                event_cardno = TO_BASE64(AES_ENCRYPT(#{eventCardno},'*#id#')),
            </if>
            <if test="eventTel != null and eventTel != ''">
                event_tel = TO_BASE64(AES_ENCRYPT(#{eventTel},'*#id#')),
            </if>
            <if test="tyshxydm != null and tyshxydm != ''">
                tyshxydm = #{tyshxydm},
            </if>
            <if test="eventRepresent != null and eventRepresent != ''">
                event_represent = #{eventRepresent},
            </if>
            <if test="remark != null and remark != ''">
                remark = #{remark},
            </if>
            update_by = #{appid},
            update_time = NOW()
        WHERE
            docking_id = #{id}
        AND appid = #{appid}
    </update>

    <insert id="insertEventUser" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventUserVo">
        INSERT INTO jl_event_user_post(
            id,
            docking_id,
            event_id,
            event_user_type,
            event_user_name,
            event_card_type,
            event_cardno,
            event_tel,
            tyshxydm,
            event_represent,
            remark,
            is_keynote,
            keynote_type,
            create_by,
            create_time,
            type,
            appid,
            operate_type,
            data_reception_time
            ) VALUES (
            UUID(),
            #{id},
            #{eventId},
            #{eventUserType},
            #{eventUserName},
            #{eventCardType},
            TO_BASE64(AES_ENCRYPT(#{eventCardno},'*#id#')),
            TO_BASE64(AES_ENCRYPT(#{eventTel},'*#id#')),
            #{tyshxydm},
            #{eventRepresent},
            #{remark},
            #{isKeynote},
            #{keynoteType},
            #{appid},
            NOW(),
            #{type},
            #{appid},
            '0',
            NOW()
        )
    </insert>

    <delete id="deleteEvent" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqDeleteIdVo">
        DELETE FROM jl_event WHERE docking_id = #{id} AND appid = #{appid}
    </delete>

    <delete id="deleteEventFlow" parameterType="string">
        delete from jl_event_flow_log where event_id = #{eventId}
    </delete>

    <select id="getNonePostEventId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEvent" resultType="string">
        select id from jl_event where docking_id = #{id} AND appid = #{appid} limit 1
    </select>

    <delete id="deleteEventCount" parameterType="string">
        delete from jl_event_count_contradiction where id = #{eventId}
    </delete>

    <delete id="deleteEventFlowCount" parameterType="string">
        delete from jl_event_flow_log_count_contradiction where event_id = #{eventId}
    </delete>

    <delete id="deleteEventFlowLog" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqDeleteIdVo">
        DELETE FROM jl_event_flow_log WHERE docking_id = #{id} AND appid = #{appid}
    </delete>

    <delete id="deleteEventUser" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqDeleteIdVo">
        DELETE FROM jl_event_user WHERE docking_id = #{id} AND appid = #{appid}
    </delete>

    <select id="selectEventTaskList" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEvent">
        SELECT
            id,
            int_id AS intId,
            docking_id AS dockingId,
            event_type AS eventType,
            event_category_id AS eventCategoryId,
            event_type_id AS eventTypeId,
            is_hidden_danger AS isHiddenDanger,
            is_special_tasks AS isSpecialTasks,
            is_difficult AS isDifficult,
            is_public_opinion AS isPublicOpinion,
            is_early_warning AS isEarlyWarning,
            is_point_event AS isPointEvent,
            is_supervise_handle AS isSuperviseHandle,
            involved_number AS involvedNumber,
            occurrence_time AS occurrenceTime,
            city_id AS cityId,
            area_id AS areaId,
            street_id AS streetId,
            community_id AS communityId,
            garden_id AS gardenId,
            building_id AS buildingId,
            unit_id AS unitId,
            floor_id AS floorId,
            doorplate_id AS doorplateId,
            event_code AS eventCode,
            event_source AS eventSource,
            address,
            dispute_description AS disputeDescription,
            reporting_name AS reportingName,
            reporting_unit AS reportingUnit,
            reporting_garden AS reportingGarden,
            `status`,
            complete_time AS completeTime,
            supervision_time AS supervisionTime,
            early_warning_time AS earlyWarningTime,
            alarm_time AS alarmTime,
            del_flag AS delFlag,
            create_by AS createBy,
            create_time AS createTime,
            update_by AS updateBy,
            update_time AS updateTime,
            appid,
            type
        FROM
            jl_event_post
        WHERE
            operate_type = '0'
        ORDER BY create_time ASC
        LIMIT 3000
    </select>

    <select id="selectEventFlowLogTaskList" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventFLowLog">
        SELECT
            id,
            int_id AS intId,
            docking_id AS dockingId,
            event_id AS eventId,
            flow_version AS flowVersion,
            flow_id AS flowId,
            office_id AS officeId,
            office_name AS officeName,
            line_name AS lineName,
            line_id AS lineId,
            grade_user_id AS gradeUserId,
            `status`,
            log_type AS logType,
            assignment_type AS assignmentType,
            risk_level AS riskLevel,
            term_time AS termTime,
            log_result AS logResult,
            assign_result AS assignResult,
            is_early_warning AS isEarlyWarning,
            event_check AS eventCheck,
            resolve_name AS resolveName,
            resolve_unit AS resolveUnit,
            resolve_hierarchy AS resolveHierarchy,
            resolve_way AS resolveWay,
            resolve_time AS resolveTime,
            is_satisfaction AS isSatisfaction,
            resolve_process AS resolveProcess,
            is_resolve AS isResolve,
            warning_level AS warningLevel,
            contacts AS contacts,
            complete_time AS completeTime,
            back_time AS backTime,
            assign_time AS assignTime,
            receive_time AS receiveTime,
            assignment_time AS assignmentTime,
            attachment,
            deal_warn_time AS dealWarnTime,
            deal_end_time AS dealEndTime,
            create_by AS createBy,
            create_name AS createName,
            create_time AS createTime,
            appid,
            type
        FROM
            jl_event_flow_log_post
        WHERE
            operate_type = '0'
        ORDER BY create_time ASC
        LIMIT 3000
    </select>

    <select id="selectEventUserTaskList" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventUser">
        SELECT
            id,
            int_id AS intId,
            docking_id AS dockingId,
            event_id AS eventId,
            event_user_type AS eventUserType,
            event_user_name AS eventUserName,
            event_card_type AS eventCardType,
            event_cardno AS eventCardno,
            event_tel AS eventTel,
            tyshxydm,
            event_represent AS eventRepresent,
            remark,
            create_by AS createBy,
            create_time AS createTime,
            is_keynote AS isKeynote,
            keynote_type AS keynoteType,
            appid,
            type
        FROM
            jl_event_user_post
        WHERE
            operate_type = '0'
        ORDER BY create_time ASC
        LIMIT 3000
    </select>

    <insert id="insertEventTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEvent">
        INSERT INTO jl_event (
            id,
            docking_id,
            event_type,
            event_category_id,
            event_type_id,
            is_hidden_danger,
            is_special_tasks,
            is_difficult,
            is_public_opinion,
            is_early_warning,
            is_point_event,
            is_supervise_handle,
            involved_number,
            occurrence_time,
            city_id,
            area_id,
            street_id,
            community_id,
            garden_id,
            building_id,
            unit_id,
            floor_id,
            doorplate_id,
            event_code,
            event_source,
            address,
            dispute_description,
            reporting_name,
            reporting_unit,
            reporting_garden,
            `status`,
            complete_time,
            supervision_time,
            early_warning_time,
            alarm_time,
            create_by,
            create_time,
            appid,
            scanning_time,
            is_scanned,
            is_acceptance
        )VALUES(
            UUID(),
            #{dockingId},
            #{eventType},
            #{eventCategoryId},
            #{eventTypeId},
            #{isHiddenDanger},
            #{isSpecialTasks},
            #{isDifficult},
            #{isPublicOpinion},
            #{isEarlyWarning},
            #{isPointEvent},
            #{isSuperviseHandle},
            #{involvedNumber},
            #{occurrenceTime},
            #{cityId},
            #{areaId},
            #{streetId},
            #{communityId},
            #{gardenId},
            #{buildingId},
            #{unitId},
            #{floorId},
            #{doorplateId},
            #{eventCode},
            #{eventSource},
            #{address},
            #{disputeDescription},
            #{reportingName},
            #{reportingUnit},
            #{reportingGarden},
            #{status},
            #{completeTime},
            #{supervisionTime},
            #{earlyWarningTime},
            #{alarmTime},
            #{appid},
            NOW(),
            #{appid},
            NOW(),
            '0',
            '1'
        )
    </insert>

    <insert id="insertEventFlowLogTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventFLowLog">
        INSERT INTO jl_event_flow_log (
            id,
            docking_id,
            event_id,
            flow_version,
            flow_id,
            office_id,
            office_name,
            line_name,
            line_id,
            grade_user_id,
            `status`,
            log_type,
            assignment_type,
            risk_level,
            term_time,
            log_result,
            assign_result,
            is_early_warning,
            event_check,
            resolve_name,
            resolve_unit,
            resolve_hierarchy,
            resolve_way,
            resolve_time,
            is_satisfaction,
            resolve_process,
            is_resolve,
            warning_level,
            contacts,
            complete_time,
            back_time,
            assign_time,
            receive_time,
            assignment_time,
            attachment,
            deal_warn_time,
            deal_end_time,
            create_by,
            create_name,
            create_time,
            appid,
            scanning_time,
            is_scanned
        )VALUES(
            UUID(),
            #{dockingId},
            #{eventId},
            #{flowVersion},
            #{flowId},
            #{officeId},
            #{officeName},
            #{lineName},
            #{lineId},
            #{gradeUserId},
            #{status},
            #{logType},
            #{assignmentType},
            #{riskLevel},
            #{termTime},
            #{logResult},
            #{assignResult},
            #{isEarlyWarning},
            #{eventCheck},
            #{resolveName},
            #{resolveUnit},
            #{resolveHierarchy},
            #{resolveWay},
            #{resolveTime},
            #{isSatisfaction},
            #{resolveProcess},
            #{isResolve},
            #{warningLevel},
            #{contacts},
            #{completeTime},
            #{backTime},
            #{assignTime},
            #{receiveTime},
            #{assignmentTime},
            #{attachment},
            #{dealWarnTime},
            #{dealEndTime},
            #{appid},
            #{createName},
            NOW(),
            #{appid},
            NOW(),
            '0'
        )
    </insert>

    <insert id="insertEventUserTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventUser">
        INSERT INTO jl_event_user (
            id,
            docking_id,
            event_id,
            event_user_type,
            event_user_name,
            event_card_type,
            event_cardno,
            event_tel,
            tyshxydm,
            event_represent,
            remark,
            create_by,
            create_time,
            is_keynote,
            keynote_type,
            appid
        )VALUES(
            UUID(),
            #{dockingId},
            #{eventId},
            #{eventUserType},
            #{eventUserName},
            #{eventCardType},
            #{eventCardno},
            #{eventTel},
            #{tyshxydm},
            #{eventRepresent},
            #{remark},
            #{appid},
            NOW(),
            #{isKeynote},
            #{keynoteType},
            #{appid}
        )
    </insert>

<!--    <update id="updateEventTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEvent">-->
<!--        UPDATE-->
<!--            jl_event-->
<!--        SET-->
<!--            event_type = #{eventType},-->
<!--            event_category_id = #{eventCategoryId},-->
<!--            event_type_id = #{eventTypeId},-->
<!--            is_hidden_danger = #{isHiddenDanger},-->
<!--            is_special_tasks = #{isSpecialTasks},-->
<!--            is_difficult = #{isDifficult},-->
<!--            is_public_opinion = #{isPublicOpinion},-->
<!--            is_early_warning = #{isEarlyWarning},-->
<!--            is_point_event = #{isPointEvent},-->
<!--            is_supervise_handle = #{isSuperviseHandle},-->
<!--            involved_number = #{involvedNumber},-->
<!--            occurrence_time = #{occurrenceTime},-->
<!--            city_id = #{cityId},-->
<!--            area_id = #{areaId},-->
<!--            street_id = #{streetId},-->
<!--            community_id = #{communityId},-->
<!--            garden_id = #{gardenId},-->
<!--            building_id = #{buildingId},-->
<!--            unit_id = #{unitId},-->
<!--            floor_id = #{floorId},-->
<!--            doorplate_id = #{doorplateId},-->
<!--            event_code = #{eventCode},-->
<!--            event_source = #{eventSource},-->
<!--            address = #{address},-->
<!--            dispute_description = #{disputeDescription},-->
<!--            reporting_name = #{reportingName},-->
<!--            reporting_unit = #{reportingUnit},-->
<!--            reporting_garden = #{reportingGarden},-->
<!--            `status` = #{status},-->
<!--            complete_time = #{completeTime},-->
<!--            supervision_time = #{supervisionTime},-->
<!--            early_warning_time = #{earlyWarningTime},-->
<!--            alarm_time = #{alarmTime},-->
<!--            update_by = #{appid},-->
<!--            update_time = NOW(),-->
<!--            scanning_time = NOW(),-->
<!--            is_scanned = '0'-->
<!--        WHERE-->
<!--            docking_id = #{dockingId}-->
<!--        AND appid = #{appid}-->
<!--    </update>-->

    <update id="updateEventTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEvent">
        UPDATE
        jl_event
        SET
        is_hidden_danger = #{isHiddenDanger},
        is_special_tasks = #{isSpecialTasks},
        is_difficult = #{isDifficult},
        is_public_opinion = #{isPublicOpinion},
        is_early_warning = #{isEarlyWarning},
        is_supervise_handle = #{isSuperviseHandle},
        involved_number = #{involvedNumber},
        occurrence_time = #{occurrenceTime},
        address = #{address},
        dispute_description = #{disputeDescription},
        reporting_name = #{reportingName},
        reporting_unit = #{reportingUnit},
        reporting_garden = #{reportingGarden},
        `status` = #{status},
        complete_time = #{completeTime},
        supervision_time = #{supervisionTime},
        early_warning_time = #{earlyWarningTime},
        alarm_time = #{alarmTime},
        update_by = #{appid},
        update_time = NOW(),
        scanning_time = NOW(),
        is_scanned = '0'
        WHERE
        docking_id = #{dockingId}
        AND appid = #{appid}
    </update>
    
    <update id="updateEventFlowLogTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventFLowLog">
        UPDATE
            jl_event_flow_log
        SET
            event_id = #{eventId},
            flow_version = #{flowVersion},
            flow_id = #{flowId},
            office_id = #{officeId},
            office_name = #{officeName},
            line_name = #{lineName},
            line_id = #{lineId},
            grade_user_id = #{gradeUserId},
            `status` = #{status},
            log_type = #{logType},
            assignment_type = #{assignmentType},
            risk_level = #{riskLevel},
            term_time = #{termTime},
            log_result = #{logResult},
            assign_result = #{assignResult},
            is_early_warning = #{isEarlyWarning},
            event_check = #{eventCheck},
            resolve_name = #{resolveName},
            resolve_unit = #{resolveUnit},
            resolve_hierarchy = #{resolveHierarchy},
            resolve_way = #{resolveWay},
            resolve_time = #{resolveTime},
            is_satisfaction = #{isSatisfaction},
            resolve_process = #{resolveProcess},
            is_resolve = #{isResolve},
            warning_level = #{warningLevel},
            contacts = #{contacts},
            complete_time = #{completeTime},
            back_time = #{backTime},
            assign_time = #{assignTime},
            receive_time = #{receiveTime},
            assignment_time = #{assignmentTime},
            attachment = #{attachment},
            deal_warn_time = #{dealWarnTime},
            deal_end_time = #{dealEndTime},
            update_by = #{appid},
            update_time = NOW(),
            scanning_time = NOW(),
            is_scanned = '0'
        WHERE
            docking_id = #{dockingId}
        AND appid = #{appid}
    </update>
    
    <update id="updateEventUserTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventUser">
        UPDATE
            jl_event_user
        SET
            event_id = #{eventId},
            event_user_type = #{eventUserType},
            event_user_name = #{eventUserName},
            event_card_type = #{eventCardType},
            event_cardno = #{eventCardno},
            event_tel = #{eventTel},
            tyshxydm = #{tyshxydm},
            event_represent = #{eventRepresent},
            remark = #{remark},
            update_by = #{appid},
            update_time = NOW(),
            is_keynote = #{isKeynote},
            keynote_type = #{keynoteType}
        WHERE
            docking_id = #{dockingId}
        AND appid = #{appid}
    </update>

    <delete id="deleteEventUserTask" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.task.JlEventUser">
        DELETE FROM jl_event_user WHERE docking_id = #{dockingId} AND appid = #{appid}
    </delete>

    <update id="updateOperateTypeEvent" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqTaskVo">
        UPDATE
            jl_event_post
        SET
            operate_type = #{operateType},
            data_processing_time = NOW()
        WHERE
            appid = #{appid}
        AND docking_id = #{dockingId}
        AND int_id = #{intId}
    </update>

    <update id="updateOperateTypeEventFlowLog" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqTaskVo">
        UPDATE
            jl_event_flow_log_post
        SET
            operate_type = #{operateType},
            data_processing_time = NOW()
        WHERE
            appid = #{appid}
        AND docking_id = #{dockingId}
        AND int_id = #{intId}
    </update>

    <update id="updateOperateTypeEventUser" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqTaskVo">
        UPDATE
            jl_event_user_post
        SET
            operate_type = #{operateType},
            data_processing_time = NOW()
        WHERE
            appid = #{appid}
        AND docking_id = #{dockingId}
        AND int_id = #{intId}
    </update>

    <select id="getEventTypeId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="String">
        SELECT
            id
        FROM
            sys_dict
        WHERE
            type = 'event_category'
        AND parent_id != '0'
        AND value = #{eventTypeId}
    </select>

    <select id="getEventCategoryId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="String">
        SELECT
        id
        FROM
        sys_dict
        WHERE
        type = 'event_category'
        AND parent_id = '0'
        AND value = #{eventCategoryId}
    </select>

    <select id="getCityId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="String">
        SELECT
            id
        FROM
            sys_area
        WHERE
            code = #{cityCode}
    </select>

    <select id="getAreaId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="String">
        SELECT
            id
        FROM
            sys_area
        WHERE
            code = #{areaCode}
    </select>

    <select id="getStreetId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="String">
        SELECT
            id
        FROM
            sys_area
        WHERE
            code = #{streetCode}
    </select>

    <select id="getCommunityId" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.task.ReqEventVo" resultType="String">
        SELECT
            id
        FROM
            sys_area
        WHERE
            code = #{communityCode}
    </select>

</mapper>
