<?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.ruoyi.system.mapper.HeiYanMapper">

    <select id="queryDeviceStatic" resultType="java.util.Map">
        select snapPos point, count(1) count
        from ship_snap_address
        group by snapPos
    </select>

    <select id="queryDeviceCount" resultType="java.lang.Integer">
        select count(1)
        from ship_snap_address
    </select>
    <select id="queryDeviceList" resultType="com.ruoyi.system.domain.DeviceBo">
        select id                               as                                deviceId,
               updateTime,
               concat(longitude, ',', latitude) as                                latilongti,
               name,
               snapPos                          as                                monitorName,
               '黑烟'                             as                                deviceType,
               case status when 'ENABLED' then '在线' when 'DISABLED' then '离线' end status,
               orgName,
               liveStreamUrl,
               'heiyan_ship_recognition'        as                                source
        from ship_snap_address
    </select>

    <select id="queryById" resultType="java.util.Map">
        select id,
               createBy,
               date_format(createTime, '%Y-%m-%d %H:%i:%s') as createTime,
               updateBy,
               date_format(updateTime, '%Y-%m-%d %H:%i:%s') as updateTime,
               aisDist,
               aisDrt,
               aisDst,
               aisMmsi,
               aisMmsi                                      as mmsi,
               aisShipLen,
               aisShipName,
               aisShipSpd,
               aisShipType,
               aisShipWidth,
               isAbnormalSize,
               latitude,
               rcgSoot,
               lockSeq,
               longitude,
               rcgCargoType,
               rcgDeadweightTon,
               rcgDist,
               rcgDrt,
               rcgIsFleet,
               rcgLoadSts,
               rcgShipHeightAboveWater,
               rcgShipLen,
               rcgShipName,
               rcgShipSpd,
               rcgShipType,
               rcgShipWidth,
               regportName,
               remark,
               snapImPath,
               snapPos,
               snapPos                                      as monitorPointName,
               snapTime,
               snapTimeFmt,
               snapTimeFmt                                  as createTime,
               status,
               textFeatureLabel,
               textImgUrl,
               rcgShipTypeDetail,
               useWarn,
               warnLabelList,
               qrcode,
               shipNameDirection,
               shipNameValid,
               sootFeatureLabel,
               sootImgUrl
        from ship_recognition
        where id = #{id}
    </select>
</mapper>