<?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.lutao.cloud.oil.mapper.CriticalAreaMapper">

    <resultMap id="criticalAreaMap" type="com.lutao.entity.CriticalArea">
        <id property="id" column="id"/>
        <result property="originId" column="origin_id"/>
        <result property="facilityName" column="facility_name"/>
        <result property="areaName" column="area_name"/>
        <result property="cameraInt" column="camera_int"/>
        <result property="pfId" column="pf_id"/>
        <result property="appId" column="app_id"/>
        <result property="platformCode" column="platform_code"/>
        <result property="platformName" column="platform_name"/>
        <result property="platformId" column="platform_id"/>
        <result property="createDate" column="create_date"/>
        <result property="createBy" column="create_by"/>
        <result property="updateDate" column="update_date"/>
        <result property="updateBy" column="update_by"/>
    </resultMap>
    <select id="getSeaPlatformVideoMonitor" resultType="com.lutao.cloud.oil.pojo.vo.SeaPlatformVideoMonitorVO">
        SELECT platform_name AS platformName, COUNT(facility_name) AS videoNumber
        FROM critical_area ca
        <where>
            <if test="param.platformId != null and param.platformId != ''">
                ca.platform_code = #{param.platformId}
            </if>
            <if test="param.appId != null and param.appId != ''">
                and ca.app_id = #{param.appId}
            </if>
        </where>
        GROUP BY platform_name
    </select>
</mapper>
