<?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.dcsoft.system.mapper.SysEquipmentMapper">

    <resultMap type="SysEquipment" id="SysEquipmentResult">
        <result property="id"    column="id"    />
        <result property="productId"    column="product_id"    />
        <result property="name"    column="name"    />
        <result property="sequence"    column="sequence"    />
        <result property="ip"    column="ip"    />
        <result property="password"    column="password"    />
        <result property="spaceId"    column="space_id"    />
        <result property="pointId"    column="point_id"    />
        <result property="remark"    column="remark"    />
        <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="state"    column="state"    />
        <result property="flag"    column="flag"    />
        <result property="comRecTimeWindow"    column="com_rec_time_window"    />
        <result property="comRecRank"    column="com_rec_rank"    />
        <result property="comRecDistModeType"    column="com_rec_dist_mode_type"    />
        <result property="languageType"    column="language_type"    />
        <result property="comRelayTime"    column="com_relay_time"    />
        <result property="timeZone"    column="time_zone"    />
        <result property="faceEnable"    column="face_enable"    />
        <result property="faceScore"    column="face_score"    />
        <result property="faceDetectionType"    column="face_detection_type"    />
        <result property="repeatRegEnable"    column="repeat_reg_enable"    />
        <result property="regInterval"    column="reg_interval"    />
        <result property="cardEnable"    column="card_enable"    />
        <result property="recSucTtsModeType"    column="rec_suc_tts_mode_type"    />
        <result property="recSucTtsModeContent"    column="rec_suc_tts_mode_content"    />
        <result property="recSucDisplayText1Type"    column="rec_suc_display_text1_type"    />
        <result property="recSucDisplayText1Content"    column="rec_suc_display_text1_content"    />
        <result property="recSucDisplayText2Type"    column="rec_suc_display_text2_type"    />
        <result property="recSucDisplayText2Content"    column="rec_suc_display_text2_content"    />
        <result property="recSucComModeType"    column="rec_suc_com_mode_type"    />
        <result property="recSucComModeContent"    column="rec_suc_com_mode_content"    />
        <result property="recSucWiegandType"    column="rec_suc_wiegand_type"    />
        <result property="recSucWiegandContent"    column="rec_suc_wiegand_content"    />
        <result property="recSucRelayType"    column="rec_suc_relay_type"    />
        <result property="recFailEnable"    column="rec_fail_enable"    />
        <result property="recFailTimesThreshold"    column="rec_fail_times_threshold"    />
        <result property="recFailTtsModeType"    column="rec_fail_tts_mode_type"    />
        <result property="recFailTtsModeContent"    column="rec_fail_tts_mode_content"    />
        <result property="recFailDisplayTextType"    column="rec_fail_display_text_type"    />
        <result property="recFailDisplayTextContent"    column="rec_fail_display_text_content"    />
        <result property="recFailComModeType"    column="rec_fail_com_mode_type"    />
        <result property="recFailComModeContent"    column="rec_fail_com_mode_content"    />
        <result property="recFailWiegandType"    column="rec_fail_wiegand_type"    />
        <result property="recFailWiegandContent"    column="rec_fail_wiegand_content"    />
        <result property="recFailRelayType"    column="rec_fail_relay_type"    />
        <result property="recNoPerTtsModeType"    column="rec_no_per_tts_mode_type"    />
        <result property="recNoPerTtsModeContent"    column="rec_no_per_tts_mode_content"    />
        <result property="recNoPerDisplayText1Type"    column="rec_no_per_display_text1_type"    />
        <result property="recNoPerDisplayText1Content"    column="rec_no_per_display_text1_content"    />
        <result property="recNoPerDisplayText2Type"    column="rec_no_per_display_text2_type"    />
        <result property="recNoPerDisplayText2Content"    column="rec_no_per_display_text2_content"    />
        <result property="recNoPerComModeType"    column="rec_no_per_com_mode_type"    />
        <result property="recNoPerComModeContent"    column="rec_no_per_com_mode_content"    />
        <result property="recNoPerWiegandType"    column="rec_no_per_wiegand_type"    />
        <result property="recNoPerWiegandContent"    column="rec_no_per_wiegand_content"    />
        <result property="recNoPerRelayType"    column="rec_no_per_relay_type"    />
        <result property="scrDisplayText1Type"    column="scr_display_text1_type"    />
        <result property="scrDisplayText1Content"    column="scr_display_text1_content"    />
        <result property="scrDisplayText2Type"    column="scr_display_text2_type"    />
        <result property="scrDisplayText2Content"    column="scr_display_text2_content"    />
        <result property="isShowDeviceKey"    column="is_show_device_key"    />
        <result property="isShowIp"    column="is_show_ip"    />
        <result property="isShowPersonCount"    column="is_show_person_count"    />
        <result property="scrImage1Url"    column="scr_image1_url"    />
        <result property="scrImage2Url"    column="scr_image2_url"    />
        <result property="isTemperatureOpen"    column="is_temperature_open"    />
        <result property="temperatureCompensation"    column="temperature_compensation"    />
        <result property="temperatureMeasureMax"    column="temperature_measure_max"    />
        <result property="temperatureMeasureMin"    column="temperature_measure_min"    />
        <result property="tempMapSwitch"    column="temp_map_switch"    />
        <result property="tempUnit"    column="temp_unit"    />
        <result property="isMaskOpen"    column="is_mask_open"    />
        <result property="errorTemperature"    column="error_temperature"    />
        <result property="backUrl"    column="back_url"    />
        <result property="isCj"    column="is_cj"    />
        <result property="entryExitType"    column="entry_exit_type"    />
        <result property="bigtype"    column="bigtype"    />
        <result property="fileType"    column="file_type"    />
        <association property="product"    column="product_id" javaType="SysProduct" resultMap="productResult" />
        <association property="point"    column="point_id" javaType="SysPoint" resultMap="pointResult" />

    </resultMap>

    <resultMap id="productResult" type="SysProduct">
        <id     property="id"    column="product_id"     />
        <result property="name"  column="productName"   />
        <result property="avatar"    column="productAvatar"    />
    </resultMap>

    <resultMap id="pointResult" type="SysPoint">
        <id     property="id"    column="point_id"     />
        <result property="name"  column="pointName"   />
    </resultMap>

    <sql id="selectSysEquipmentVo">
        select e.id, e.product_id, e.name, e.sequence, e.ip, e.password, e.space_id, e.point_id, e.remark, e.create_by, e.create_time, e.update_by, e.update_time, e.state,
               e.flag, e.com_rec_time_window, e.com_rec_rank, e.com_rec_dist_mode_type, e.language_type, e.com_relay_time, e.time_zone, e.face_enable, e.face_score, e.face_detection_type,
               e.repeat_reg_enable, e.reg_interval,e.card_enable, e.rec_suc_tts_mode_type, e.rec_suc_tts_mode_content, e.rec_suc_display_text1_type, e.rec_suc_display_text1_content,
               e.rec_suc_display_text2_type, e.rec_suc_display_text2_content, e.rec_suc_com_mode_type, e.rec_suc_com_mode_content, e.rec_suc_wiegand_type, e.rec_suc_wiegand_content,
               e.rec_suc_relay_type, e.rec_fail_enable, e.rec_fail_times_threshold, e.rec_fail_tts_mode_type, e.rec_fail_tts_mode_content, e.rec_fail_display_text_type, e.rec_fail_display_text_content,
               e.rec_fail_com_mode_type,e.rec_fail_com_mode_content, e.rec_fail_wiegand_type, e.rec_fail_wiegand_content, e.rec_fail_relay_type, e.rec_no_per_tts_mode_type, e.rec_no_per_tts_mode_content,
               e.rec_no_per_display_text1_type, e.rec_no_per_display_text1_content, e.rec_no_per_display_text2_type, e.rec_no_per_display_text2_content, e.rec_no_per_com_mode_type, e.rec_no_per_com_mode_content,
               e.rec_no_per_wiegand_type, e.rec_no_per_wiegand_content, e.rec_no_per_relay_type, e.scr_display_text1_type, e.scr_display_text1_content, e.scr_display_text2_type, e.scr_display_text2_content,
               e.is_show_device_key, e.is_show_ip, e.is_show_person_count, e.scr_image1_url, e.scr_image2_url, e.is_temperature_open, e.temperature_compensation, e.temperature_measure_max, e.temperature_measure_min,
               e.temp_map_switch, e.temp_unit, e.is_mask_open, e.error_temperature,p.avatar productAvatar,p.name productName,pt.name pointName,e.back_url,e.is_cj,
               e.entry_exit_type, p.bigtype, e.file_type
        from sys_equipment e
        left join sys_product p on e.product_id = p.id
        left join sys_point pt on e.point_id = pt.id

    </sql>

    <select id="selectSysEquipmentList" parameterType="SysEquipment" resultMap="SysEquipmentResult">
        <include refid="selectSysEquipmentVo"/>
        <where>
            <if test="productId != null "> and e.product_id = #{productId}</if>
            <if test="name != null  and name != ''"> and e.name like concat('%', #{name}, '%')</if>
            <if test="sequence != null  and sequence != ''"> and e.sequence = #{sequence}</if>
            <if test="ip != null  and ip != ''"> and e.ip = #{ip}</if>
            <if test="password != null  and password != ''"> and e.password = #{password}</if>
            <if test="spaceId != null "> and e.space_id = #{spaceId}</if>
            <if test="pointId != null "> and e.point_id = #{pointId}</if>
            <if test="isCj != null  and isCj != ''"> and e.is_cj = #{isCj}</if>
            <if test="flag != null  and flag != ''"> and e.flag = #{flag}</if>
            <if test="bigtype != null  and bigtype != ''"> and p.bigtype = #{bigtype}</if>
        </where>
    </select>

    <select id="selectSysEquipmentById" parameterType="Long" resultMap="SysEquipmentResult">
        <include refid="selectSysEquipmentVo"/>
        where e.id = #{id}
    </select>

    <insert id="insertSysEquipment" parameterType="SysEquipment">
        insert into sys_equipment
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="productId != null">product_id,</if>
            <if test="name != null and name != ''">name,</if>
            <if test="sequence != null">sequence,</if>
            <if test="ip != null">ip,</if>
            <if test="password != null">password,</if>
            <if test="spaceId != null">space_id,</if>
            <if test="pointId != null">point_id,</if>
            <if test="remark != null">remark,</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="state != null">state,</if>
            <if test="flag != null">flag,</if>
            <if test="comRecTimeWindow != null">com_rec_time_window,</if>
            <if test="comRecRank != null">com_rec_rank,</if>
            <if test="comRecDistModeType != null">com_rec_dist_mode_type,</if>
            <if test="languageType != null">language_type,</if>
            <if test="comRelayTime != null">com_relay_time,</if>
            <if test="timeZone != null">time_zone,</if>
            <if test="faceEnable != null">face_enable,</if>
            <if test="faceScore != null">face_score,</if>
            <if test="faceDetectionType != null">face_detection_type,</if>
            <if test="repeatRegEnable != null">repeat_reg_enable,</if>
            <if test="regInterval != null">reg_interval,</if>
            <if test="cardEnable != null">card_enable,</if>
            <if test="recSucTtsModeType != null">rec_suc_tts_mode_type,</if>
            <if test="recSucTtsModeContent != null">rec_suc_tts_mode_content,</if>
            <if test="recSucDisplayText1Type != null">rec_suc_display_text1_type,</if>
            <if test="recSucDisplayText1Content != null">rec_suc_display_text1_content,</if>
            <if test="recSucDisplayText2Type != null">rec_suc_display_text2_type,</if>
            <if test="recSucDisplayText2Content != null">rec_suc_display_text2_content,</if>
            <if test="recSucComModeType != null">rec_suc_com_mode_type,</if>
            <if test="recSucComModeContent != null">rec_suc_com_mode_content,</if>
            <if test="recSucWiegandType != null">rec_suc_wiegand_type,</if>
            <if test="recSucWiegandContent != null">rec_suc_wiegand_content,</if>
            <if test="recSucRelayType != null">rec_suc_relay_type,</if>
            <if test="recFailEnable != null">rec_fail_enable,</if>
            <if test="recFailTimesThreshold != null">rec_fail_times_threshold,</if>
            <if test="recFailTtsModeType != null">rec_fail_tts_mode_type,</if>
            <if test="recFailTtsModeContent != null">rec_fail_tts_mode_content,</if>
            <if test="recFailDisplayTextType != null">rec_fail_display_text_type,</if>
            <if test="recFailDisplayTextContent != null">rec_fail_display_text_content,</if>
            <if test="recFailComModeType != null">rec_fail_com_mode_type,</if>
            <if test="recFailComModeContent != null">rec_fail_com_mode_content,</if>
            <if test="recFailWiegandType != null">rec_fail_wiegand_type,</if>
            <if test="recFailWiegandContent != null">rec_fail_wiegand_content,</if>
            <if test="recFailRelayType != null">rec_fail_relay_type,</if>
            <if test="recNoPerTtsModeType != null">rec_no_per_tts_mode_type,</if>
            <if test="recNoPerTtsModeContent != null">rec_no_per_tts_mode_content,</if>
            <if test="recNoPerDisplayText1Type != null">rec_no_per_display_text1_type,</if>
            <if test="recNoPerDisplayText1Content != null">rec_no_per_display_text1_content,</if>
            <if test="recNoPerDisplayText2Type != null">rec_no_per_display_text2_type,</if>
            <if test="recNoPerDisplayText2Content != null">rec_no_per_display_text2_content,</if>
            <if test="recNoPerComModeType != null">rec_no_per_com_mode_type,</if>
            <if test="recNoPerComModeContent != null">rec_no_per_com_mode_content,</if>
            <if test="recNoPerWiegandType != null">rec_no_per_wiegand_type,</if>
            <if test="recNoPerWiegandContent != null">rec_no_per_wiegand_content,</if>
            <if test="recNoPerRelayType != null">rec_no_per_relay_type,</if>
            <if test="scrDisplayText1Type != null">scr_display_text1_type,</if>
            <if test="scrDisplayText1Content != null">scr_display_text1_content,</if>
            <if test="scrDisplayText2Type != null">scr_display_text2_type,</if>
            <if test="scrDisplayText2Content != null">scr_display_text2_content,</if>
            <if test="isShowDeviceKey != null">is_show_device_key,</if>
            <if test="isShowIp != null">is_show_ip,</if>
            <if test="isShowPersonCount != null">is_show_person_count,</if>
            <if test="scrImage1Url != null">scr_image1_url,</if>
            <if test="scrImage2Url != null">scr_image2_url,</if>
            <if test="isTemperatureOpen != null">is_temperature_open,</if>
            <if test="temperatureCompensation != null">temperature_compensation,</if>
            <if test="temperatureMeasureMax != null">temperature_measure_max,</if>
            <if test="temperatureMeasureMin != null">temperature_measure_min,</if>
            <if test="tempMapSwitch != null">temp_map_switch,</if>
            <if test="tempUnit != null">temp_unit,</if>
            <if test="isMaskOpen != null">is_mask_open,</if>
            <if test="errorTemperature != null">error_temperature,</if>
            <if test="backUrl != null">back_url,</if>
            <if test="isCj != null">is_cj,</if>
            <if test="entryExitType != null">entry_exit_type,</if>

        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="productId != null">#{productId},</if>
            <if test="name != null and name != ''">#{name},</if>
            <if test="sequence != null">#{sequence},</if>
            <if test="ip != null">#{ip},</if>
            <if test="password != null">#{password},</if>
            <if test="spaceId != null">#{spaceId},</if>
            <if test="pointId != null">#{pointId},</if>
            <if test="remark != null">#{remark},</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="state != null">#{state},</if>
            <if test="flag != null">#{flag},</if>
            <if test="comRecTimeWindow != null">#{comRecTimeWindow},</if>
            <if test="comRecRank != null">#{comRecRank},</if>
            <if test="comRecDistModeType != null">#{comRecDistModeType},</if>
            <if test="languageType != null">#{languageType},</if>
            <if test="comRelayTime != null">#{comRelayTime},</if>
            <if test="timeZone != null">#{timeZone},</if>
            <if test="faceEnable != null">#{faceEnable},</if>
            <if test="faceScore != null">#{faceScore},</if>
            <if test="faceDetectionType != null">#{faceDetectionType},</if>
            <if test="repeatRegEnable != null">#{repeatRegEnable},</if>
            <if test="regInterval != null">#{regInterval},</if>
            <if test="cardEnable != null">#{cardEnable},</if>
            <if test="recSucTtsModeType != null">#{recSucTtsModeType},</if>
            <if test="recSucTtsModeContent != null">#{recSucTtsModeContent},</if>
            <if test="recSucDisplayText1Type != null">#{recSucDisplayText1Type},</if>
            <if test="recSucDisplayText1Content != null">#{recSucDisplayText1Content},</if>
            <if test="recSucDisplayText2Type != null">#{recSucDisplayText2Type},</if>
            <if test="recSucDisplayText2Content != null">#{recSucDisplayText2Content},</if>
            <if test="recSucComModeType != null">#{recSucComModeType},</if>
            <if test="recSucComModeContent != null">#{recSucComModeContent},</if>
            <if test="recSucWiegandType != null">#{recSucWiegandType},</if>
            <if test="recSucWiegandContent != null">#{recSucWiegandContent},</if>
            <if test="recSucRelayType != null">#{recSucRelayType},</if>
            <if test="recFailEnable != null">#{recFailEnable},</if>
            <if test="recFailTimesThreshold != null">#{recFailTimesThreshold},</if>
            <if test="recFailTtsModeType != null">#{recFailTtsModeType},</if>
            <if test="recFailTtsModeContent != null">#{recFailTtsModeContent},</if>
            <if test="recFailDisplayTextType != null">#{recFailDisplayTextType},</if>
            <if test="recFailDisplayTextContent != null">#{recFailDisplayTextContent},</if>
            <if test="recFailComModeType != null">#{recFailComModeType},</if>
            <if test="recFailComModeContent != null">#{recFailComModeContent},</if>
            <if test="recFailWiegandType != null">#{recFailWiegandType},</if>
            <if test="recFailWiegandContent != null">#{recFailWiegandContent},</if>
            <if test="recFailRelayType != null">#{recFailRelayType},</if>
            <if test="recNoPerTtsModeType != null">#{recNoPerTtsModeType},</if>
            <if test="recNoPerTtsModeContent != null">#{recNoPerTtsModeContent},</if>
            <if test="recNoPerDisplayText1Type != null">#{recNoPerDisplayText1Type},</if>
            <if test="recNoPerDisplayText1Content != null">#{recNoPerDisplayText1Content},</if>
            <if test="recNoPerDisplayText2Type != null">#{recNoPerDisplayText2Type},</if>
            <if test="recNoPerDisplayText2Content != null">#{recNoPerDisplayText2Content},</if>
            <if test="recNoPerComModeType != null">#{recNoPerComModeType},</if>
            <if test="recNoPerComModeContent != null">#{recNoPerComModeContent},</if>
            <if test="recNoPerWiegandType != null">#{recNoPerWiegandType},</if>
            <if test="recNoPerWiegandContent != null">#{recNoPerWiegandContent},</if>
            <if test="recNoPerRelayType != null">#{recNoPerRelayType},</if>
            <if test="scrDisplayText1Type != null">#{scrDisplayText1Type},</if>
            <if test="scrDisplayText1Content != null">#{scrDisplayText1Content},</if>
            <if test="scrDisplayText2Type != null">#{scrDisplayText2Type},</if>
            <if test="scrDisplayText2Content != null">#{scrDisplayText2Content},</if>
            <if test="isShowDeviceKey != null">#{isShowDeviceKey},</if>
            <if test="isShowIp != null">#{isShowIp},</if>
            <if test="isShowPersonCount != null">#{isShowPersonCount},</if>
            <if test="scrImage1Url != null">#{scrImage1Url},</if>
            <if test="scrImage2Url != null">#{scrImage2Url},</if>
            <if test="isTemperatureOpen != null">#{isTemperatureOpen},</if>
            <if test="temperatureCompensation != null">#{temperatureCompensation},</if>
            <if test="temperatureMeasureMax != null">#{temperatureMeasureMax},</if>
            <if test="temperatureMeasureMin != null">#{temperatureMeasureMin},</if>
            <if test="tempMapSwitch != null">#{tempMapSwitch},</if>
            <if test="tempUnit != null">#{tempUnit},</if>
            <if test="isMaskOpen != null">#{isMaskOpen},</if>
            <if test="errorTemperature != null">#{errorTemperature},</if>
            <if test="backUrl != null">#{backUrl},</if>
            <if test="isCj != null">#{isCj},</if>
            <if test="entryExitType != null">#{entryExitType},</if>
        </trim>
    </insert>
    <insert id="saveFile">
        insert into sys_file (id, business_id, business_type, url, file_name) VALUES
        <foreach collection="list" item="i" index="index" separator=",">
            (
            #{i.id},
            #{i.businessId},
            #{i.businessType},
            #{i.url},
            #{i.fileName}
            )
        </foreach>
    </insert>

    <update id="updateSysEquipment" parameterType="SysEquipment">
        update sys_equipment
        <trim prefix="SET" suffixOverrides=",">
            <if test="productId != null">product_id = #{productId},</if>
            <if test="name != null and name != ''">name = #{name},</if>
            <if test="sequence != null">sequence = #{sequence},</if>
            <if test="ip != null">ip = #{ip},</if>
            <if test="password != null">password = #{password},</if>
            <if test="spaceId != null">space_id = #{spaceId},</if>
            <if test="pointId != null">point_id = #{pointId},</if>
            <if test="remark != null">remark = #{remark},</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="state != null">state = #{state},</if>
            <if test="flag != null">flag = #{flag},</if>
            <if test="comRecTimeWindow != null">com_rec_time_window = #{comRecTimeWindow},</if>
            <if test="comRecRank != null">com_rec_rank = #{comRecRank},</if>
            <if test="comRecDistModeType != null">com_rec_dist_mode_type = #{comRecDistModeType},</if>
            <if test="languageType != null">language_type = #{languageType},</if>
            <if test="comRelayTime != null">com_relay_time = #{comRelayTime},</if>
            <if test="timeZone != null">time_zone = #{timeZone},</if>
            <if test="faceEnable != null">face_enable = #{faceEnable},</if>
            <if test="faceScore != null">face_score = #{faceScore},</if>
            <if test="faceDetectionType != null">face_detection_type = #{faceDetectionType},</if>
            <if test="repeatRegEnable != null">repeat_reg_enable = #{repeatRegEnable},</if>
            <if test="regInterval != null">reg_interval = #{regInterval},</if>
            <if test="cardEnable != null">card_enable = #{cardEnable},</if>
            <if test="recSucTtsModeType != null">rec_suc_tts_mode_type = #{recSucTtsModeType},</if>
            <if test="recSucTtsModeContent != null">rec_suc_tts_mode_content = #{recSucTtsModeContent},</if>
            <if test="recSucDisplayText1Type != null">rec_suc_display_text1_type = #{recSucDisplayText1Type},</if>
            <if test="recSucDisplayText1Content != null">rec_suc_display_text1_content = #{recSucDisplayText1Content},</if>
            <if test="recSucDisplayText2Type != null">rec_suc_display_text2_type = #{recSucDisplayText2Type},</if>
            <if test="recSucDisplayText2Content != null">rec_suc_display_text2_content = #{recSucDisplayText2Content},</if>
            <if test="recSucComModeType != null">rec_suc_com_mode_type = #{recSucComModeType},</if>
            <if test="recSucComModeContent != null">rec_suc_com_mode_content = #{recSucComModeContent},</if>
            <if test="recSucWiegandType != null">rec_suc_wiegand_type = #{recSucWiegandType},</if>
            <if test="recSucWiegandContent != null">rec_suc_wiegand_content = #{recSucWiegandContent},</if>
            <if test="recSucRelayType != null">rec_suc_relay_type = #{recSucRelayType},</if>
            <if test="recFailEnable != null">rec_fail_enable = #{recFailEnable},</if>
            <if test="recFailTimesThreshold != null">rec_fail_times_threshold = #{recFailTimesThreshold},</if>
            <if test="recFailTtsModeType != null">rec_fail_tts_mode_type = #{recFailTtsModeType},</if>
            <if test="recFailTtsModeContent != null">rec_fail_tts_mode_content = #{recFailTtsModeContent},</if>
            <if test="recFailDisplayTextType != null">rec_fail_display_text_type = #{recFailDisplayTextType},</if>
            <if test="recFailDisplayTextContent != null">rec_fail_display_text_content = #{recFailDisplayTextContent},</if>
            <if test="recFailComModeType != null">rec_fail_com_mode_type = #{recFailComModeType},</if>
            <if test="recFailComModeContent != null">rec_fail_com_mode_content = #{recFailComModeContent},</if>
            <if test="recFailWiegandType != null">rec_fail_wiegand_type = #{recFailWiegandType},</if>
            <if test="recFailWiegandContent != null">rec_fail_wiegand_content = #{recFailWiegandContent},</if>
            <if test="recFailRelayType != null">rec_fail_relay_type = #{recFailRelayType},</if>
            <if test="recNoPerTtsModeType != null">rec_no_per_tts_mode_type = #{recNoPerTtsModeType},</if>
            <if test="recNoPerTtsModeContent != null">rec_no_per_tts_mode_content = #{recNoPerTtsModeContent},</if>
            <if test="recNoPerDisplayText1Type != null">rec_no_per_display_text1_type = #{recNoPerDisplayText1Type},</if>
            <if test="recNoPerDisplayText1Content != null">rec_no_per_display_text1_content = #{recNoPerDisplayText1Content},</if>
            <if test="recNoPerDisplayText2Type != null">rec_no_per_display_text2_type = #{recNoPerDisplayText2Type},</if>
            <if test="recNoPerDisplayText2Content != null">rec_no_per_display_text2_content = #{recNoPerDisplayText2Content},</if>
            <if test="recNoPerComModeType != null">rec_no_per_com_mode_type = #{recNoPerComModeType},</if>
            <if test="recNoPerComModeContent != null">rec_no_per_com_mode_content = #{recNoPerComModeContent},</if>
            <if test="recNoPerWiegandType != null">rec_no_per_wiegand_type = #{recNoPerWiegandType},</if>
            <if test="recNoPerWiegandContent != null">rec_no_per_wiegand_content = #{recNoPerWiegandContent},</if>
            <if test="recNoPerRelayType != null">rec_no_per_relay_type = #{recNoPerRelayType},</if>
            <if test="scrDisplayText1Type != null">scr_display_text1_type = #{scrDisplayText1Type},</if>
            <if test="scrDisplayText1Content != null">scr_display_text1_content = #{scrDisplayText1Content},</if>
            <if test="scrDisplayText2Type != null">scr_display_text2_type = #{scrDisplayText2Type},</if>
            <if test="scrDisplayText2Content != null">scr_display_text2_content = #{scrDisplayText2Content},</if>
            <if test="isShowDeviceKey != null">is_show_device_key = #{isShowDeviceKey},</if>
            <if test="isShowIp != null">is_show_ip = #{isShowIp},</if>
            <if test="isShowPersonCount != null">is_show_person_count = #{isShowPersonCount},</if>
            <if test="scrImage1Url != null">scr_image1_url = #{scrImage1Url},</if>
            <if test="scrImage2Url != null">scr_image2_url = #{scrImage2Url},</if>
            <if test="isTemperatureOpen != null">is_temperature_open = #{isTemperatureOpen},</if>
            <if test="temperatureCompensation != null">temperature_compensation = #{temperatureCompensation},</if>
            <if test="temperatureMeasureMax != null">temperature_measure_max = #{temperatureMeasureMax},</if>
            <if test="temperatureMeasureMin != null">temperature_measure_min = #{temperatureMeasureMin},</if>
            <if test="tempMapSwitch != null">temp_map_switch = #{tempMapSwitch},</if>
            <if test="tempUnit != null">temp_unit = #{tempUnit},</if>
            <if test="isMaskOpen != null">is_mask_open = #{isMaskOpen},</if>
            <if test="errorTemperature != null">error_temperature = #{errorTemperature},</if>
            <if test="backUrl != null">back_url = #{backUrl},</if>
            <if test="isCj != null">is_cj = #{isCj},</if>
            <if test="entryExitType != null">entry_exit_type = #{entryExitType},</if>
            <if test="fileType != null">file_type = #{fileType},</if>
        </trim>
        where id = #{id}
    </update>
    <update id="updateEquipmentByDeviceKey">
        update sys_equipment
        <trim prefix="SET" suffixOverrides=",">
            <if test="password != null">password = #{password},</if>
            <if test="deviceIp != null">ip = #{deviceIp},</if>
            <if test="name != null">name = #{name},</if>
            <if test="fileType != null">file_type = #{fileType},</if>
        </trim>
        where sequence = #{deviceKey}
    </update>

    <delete id="deleteSysEquipmentById" parameterType="Long">
        delete from sys_equipment where id = #{id}
    </delete>

    <delete id="deleteSysEquipmentByIds" parameterType="String">
        delete from sys_equipment where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="deleteFile">
        delete from sys_file where business_id = #{businessId} and business_type = #{businessType}
    </delete>

    <select id="selectEquipmentBySequence" parameterType="String" resultMap="SysEquipmentResult">
        <include refid="selectSysEquipmentVo"/>
        where e.sequence = #{sequence}
    </select>
    <select id="queryEquipmentInfo" resultType="com.dcsoft.system.domain.SysEquipment">
        select ip, password
        from sys_equipment
        where point_id in
        <foreach item="pointId" collection="pointIds" open="(" separator="," close=")">
            #{pointId}
        </foreach>
    </select>
    <select id="queryPeopleInfo" resultType="com.dcsoft.system.domain.SysPeople">
        select ser.id,
               p.name,
               ser.people_id,
               ser.info_down,
               ser.empower,
               ser.equipment_id,
               ser.status,
               ser.remark,
               ser.rule_id ruleId,
               p.name      peopleName,
               p.avatar    peopleAvatar,
               e.name      equipmentName
        from sys_empower_record ser
                 left join sys_people p on ser.people_id = p.id
                 left join sys_equipment e on ser.equipment_id = e.id
        where p.del_flag = '0'
          and e.sequence = #{sequence}
          and p.gh = #{gh}
        limit 1
    </select>

    <select id="selectSysEquipmentPeopleById" parameterType="Long" resultType="java.util.Map">
        select distinct people_id
        from sys_empower_record ser where equipment_id= #{id} and status='0'
    </select>
    <select id="queryDeviceSequence" resultType="java.lang.String">
        select sp.bigtype from sys_equipment se left join sys_product sp on se.product_id = sp.id where se.sequence = #{deviceKey}
    </select>
    <select id="queryEmpowerRecord" resultType="com.dcsoft.system.domain.SysEmpowerRecord">
        select ser.rule_id
        from sys_empower_record ser
                 left join sys_people sp on ser.people_id = sp.id and sp.del_flag = '0'
                 left join sys_equipment se on se.id = ser.equipment_id
        where sp.gh = #{gh}
          and se.sequence = #{sequence}
        group by ser.rule_id
    </select>
    <select id="queryPeople" resultType="com.dcsoft.system.domain.SysPeople">
        select name, gh, door_no, id
        from sys_people
        where 1=1
        <if test="gh != null and gh != ''">
            and gh = #{gh}
        </if>
        <if test="doorNo != null and doorNo != ''">
            and door_no = #{doorNo}
        </if>
        limit 1
    </select>
    <select id="queryEmpower" resultType="com.dcsoft.system.domain.SysEquipment">
        select name, sequence, id from sys_equipment where sequence = #{sequence} limit 1
    </select>
    <select id="queryEquipmentByDeviceKey" resultType="com.dcsoft.system.domain.SysEquipment">
        select name, sequence, id, ip, password, file_type fileType
        from sys_equipment
        where 1=1
        <if test="deviceKey != null and deviceKey != ''">
            and sequence = #{deviceKey}
        </if>
        limit 1
    </select>
    <select id="queryEquipmentByIp" resultType="com.dcsoft.system.domain.SysEquipment">
        select name, sequence, id, ip, password
        from sys_equipment
        where ip in
        <foreach item="ip" collection="ipList" open="(" separator="," close=")">
            #{ip}
        </foreach>
    </select>
    <select id="queryFile" resultType="com.dcsoft.system.domain.vo.SysFileVo">
        select url, file_name fileName from sys_file where business_id = #{businessId} and business_type = #{businessType}
    </select>
</mapper>
