<?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.unis.equipmentOnlineRateAssessment.modular.monitorNvr.mapper.MonitorNvrMapper">


    <select id="findNvr"
            resultType="com.unis.equipmentOnlineRateAssessment.modular.monitorCamera.vo.CameraAndNvrVO">
        select * from monitor_nvr
        <where>
            <if test="name != null and name != ''">
                name like concat('%',#{name},'%')
            </if>
        </where>
    </select>

    <select id="selectAllNum" resultType="java.lang.Integer">
        select count(id) nvrAll from monitor_nvr
        <where>
            <if test="orgId!=null and orgId!=''">
                and org_id=#{orgId}
            </if>
        </where>
    </select>

    <select id="selectByNVRDates" resultType="java.util.HashMap" parameterType="java.util.Map" >
        SELECT
        camera.id camera_id,
        camera.alias,
        camera.factory,
        camera.live,
        camera.ip camera_ip,
        camera.username camera_name,
        camera.password camera_password,
        camera.port camera_port,
        camera.type camera_type,
        nvr.ip nvr_ip,
        nvr.username nvr_name,
        nvr. PASSWORD nvr_password,
        nvr. PORT nvr_port,
        nvr.factory nvr_factory,
        camera.channel_number,
        camera.org_id
        FROM
        depot_qh.monitor_camera camera
        LEFT JOIN depot_qh.monitor_nvr nvr ON nvr.id = camera.nvr_id
        WHERE camera.isremove = '1' AND nvr.delete_mark = '1' AND camera.org_id = #{orgId,jdbcType=VARCHAR} AND nvr.org_id = #{orgId,jdbcType=VARCHAR}
        group by camera.id
    </select>
</mapper>