<?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.eg.mapper.EgDeviceMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.usky.eg.domain.EgDevice">
        <id column="id" property="id" />
        <result column="device_uuid" property="deviceUuid" />
        <result column="device_id" property="deviceId" />
        <result column="device_name" property="deviceName" />
        <result column="install_address" property="installAddress" />
        <result column="service_status" property="serviceStatus" />
        <result column="device_ip" property="deviceIp" />
        <result column="bind_face" property="bindFace" />
        <result column="bind_person" property="bindPerson" />
        <result column="create_by" property="createBy" />
        <result column="update_by" property="updateBy" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="dept_id" property="deptId" />
        <result column="tenant_id" property="tenantId" />
        <result column="img_path" property="imgPath" />
        <result column="remark" property="remark" />
        <result column="open_mode" property="openMode" />
        <result column="password" property="password" />
        <result column="work_status" property="workStatus" />
    </resultMap>
    <insert id="insertMeetingFaceDevice" parameterType="integer">
        insert into meeting_face_device (face_id,device_id) value (#{fid}, #{egDeviceId});
    </insert>
    <delete id="deleteMeetingFaceDevice" parameterType="integer">
        delete from meeting_face_device where device_id = #{egDeviceId};
    </delete>
    <select id="sysTenantId" resultType="integer">
        select id
        from sys_tenant
        <where>
            <if test="1 == 1">
                and domain = #{domain}
            </if>
        </where>
    </select>
    <select id="getMeetingFaceData" resultType="integer">
        select mf.fid as fid
        from meeting_face mf
        <where>
            <if test="userId != null">
                and mf.user_id = #{userId}
            </if>
        </where>
    </select>
    <select id="getMeetingFaceDeviceList" resultType="integer">
        select mfd.device_id as deviceFid
        from meeting_face_device mfd
        <where>
            <if test="fid != null">
                and mfd.face_id = #{fid}
            </if>
        </where>
    </select>

</mapper>
