|  |  |  | 
|---|
|  |  |  | "mobilePositionSubmissionInterval," + | 
|---|
|  |  |  | "subscribeCycleForAlarm," + | 
|---|
|  |  |  | "ssrcCheck," + | 
|---|
|  |  |  | "asMessageChannel," + | 
|---|
|  |  |  | "geoCoordSys," + | 
|---|
|  |  |  | "treeType," + | 
|---|
|  |  |  | "online" + | 
|---|
|  |  |  | "online," + | 
|---|
|  |  |  | "mediaServerId," + | 
|---|
|  |  |  | "(SELECT count(0) FROM device_channel WHERE deviceId=device.deviceId) as channelCount "+ | 
|---|
|  |  |  | " FROM device WHERE deviceId = #{deviceId}") | 
|---|
|  |  |  | Device getDeviceByDeviceId(String deviceId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | "expires," + | 
|---|
|  |  |  | "registerTime," + | 
|---|
|  |  |  | "keepaliveTime," + | 
|---|
|  |  |  | "keepaliveIntervalTime," + | 
|---|
|  |  |  | "createTime," + | 
|---|
|  |  |  | "updateTime," + | 
|---|
|  |  |  | "charset," + | 
|---|
|  |  |  | 
|---|
|  |  |  | "mobilePositionSubmissionInterval," + | 
|---|
|  |  |  | "subscribeCycleForAlarm," + | 
|---|
|  |  |  | "ssrcCheck," + | 
|---|
|  |  |  | "asMessageChannel," + | 
|---|
|  |  |  | "geoCoordSys," + | 
|---|
|  |  |  | "treeType," + | 
|---|
|  |  |  | "online" + | 
|---|
|  |  |  | 
|---|
|  |  |  | "#{expires}," + | 
|---|
|  |  |  | "#{registerTime}," + | 
|---|
|  |  |  | "#{keepaliveTime}," + | 
|---|
|  |  |  | "#{keepaliveIntervalTime}," + | 
|---|
|  |  |  | "#{createTime}," + | 
|---|
|  |  |  | "#{updateTime}," + | 
|---|
|  |  |  | "#{charset}," + | 
|---|
|  |  |  | 
|---|
|  |  |  | "#{mobilePositionSubmissionInterval}," + | 
|---|
|  |  |  | "#{subscribeCycleForAlarm}," + | 
|---|
|  |  |  | "#{ssrcCheck}," + | 
|---|
|  |  |  | "#{asMessageChannel}," + | 
|---|
|  |  |  | "#{geoCoordSys}," + | 
|---|
|  |  |  | "#{treeType}," + | 
|---|
|  |  |  | "#{online}" + | 
|---|
|  |  |  | 
|---|
|  |  |  | "<if test=\"online != null\">, online=#{online}</if>" + | 
|---|
|  |  |  | "<if test=\"registerTime != null\">, registerTime=#{registerTime}</if>" + | 
|---|
|  |  |  | "<if test=\"keepaliveTime != null\">, keepaliveTime=#{keepaliveTime}</if>" + | 
|---|
|  |  |  | "<if test=\"keepaliveIntervalTime != null\">, keepaliveIntervalTime=#{keepaliveIntervalTime}</if>" + | 
|---|
|  |  |  | "<if test=\"expires != null\">, expires=#{expires}</if>" + | 
|---|
|  |  |  | "WHERE deviceId=#{deviceId}"+ | 
|---|
|  |  |  | " </script>"}) | 
|---|
|  |  |  | int update(Device device); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("SELECT " + | 
|---|
|  |  |  | @Select( | 
|---|
|  |  |  | " <script>" + | 
|---|
|  |  |  | "SELECT " + | 
|---|
|  |  |  | "deviceId, " + | 
|---|
|  |  |  | "coalesce(custom_name, name) as name, " + | 
|---|
|  |  |  | "password, " + | 
|---|
|  |  |  | 
|---|
|  |  |  | "mobilePositionSubmissionInterval," + | 
|---|
|  |  |  | "subscribeCycleForAlarm," + | 
|---|
|  |  |  | "ssrcCheck," + | 
|---|
|  |  |  | "asMessageChannel," + | 
|---|
|  |  |  | "geoCoordSys," + | 
|---|
|  |  |  | "treeType," + | 
|---|
|  |  |  | "online," + | 
|---|
|  |  |  | "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de") | 
|---|
|  |  |  | List<Device> getDevices(); | 
|---|
|  |  |  | "mediaServerId," + | 
|---|
|  |  |  | "(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount  FROM device de" + | 
|---|
|  |  |  | "<if test=\"online != null\"> where online=${online}</if>"+ | 
|---|
|  |  |  | " </script>" | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | List<Device> getDevices(Boolean online); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Delete("DELETE FROM device WHERE deviceId=#{deviceId}") | 
|---|
|  |  |  | int del(String deviceId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Update("UPDATE device SET online=0") | 
|---|
|  |  |  | int outlineForAll(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("SELECT " + | 
|---|
|  |  |  | "deviceId, " + | 
|---|
|  |  |  | "coalesce(custom_name, name) as name, " + | 
|---|
|  |  |  | 
|---|
|  |  |  | "mobilePositionSubmissionInterval," + | 
|---|
|  |  |  | "subscribeCycleForAlarm," + | 
|---|
|  |  |  | "ssrcCheck," + | 
|---|
|  |  |  | "asMessageChannel," + | 
|---|
|  |  |  | "geoCoordSys," + | 
|---|
|  |  |  | "treeType," + | 
|---|
|  |  |  | "online " + | 
|---|
|  |  |  | 
|---|
|  |  |  | "mobilePositionSubmissionInterval," + | 
|---|
|  |  |  | "subscribeCycleForAlarm," + | 
|---|
|  |  |  | "ssrcCheck," + | 
|---|
|  |  |  | "asMessageChannel," + | 
|---|
|  |  |  | "geoCoordSys," + | 
|---|
|  |  |  | "treeType," + | 
|---|
|  |  |  | "online" + | 
|---|
|  |  |  | 
|---|
|  |  |  | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" + | 
|---|
|  |  |  | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" + | 
|---|
|  |  |  | "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" + | 
|---|
|  |  |  | "<if test=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</if>" + | 
|---|
|  |  |  | "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + | 
|---|
|  |  |  | "<if test=\"treeType != null\">, treeType=#{treeType}</if>" + | 
|---|
|  |  |  | "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + | 
|---|
|  |  |  | "WHERE deviceId=#{deviceId}"+ | 
|---|
|  |  |  | " </script>"}) | 
|---|
|  |  |  | int updateCustom(Device device); | 
|---|
|  |  |  | void updateCustom(Device device); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Insert("INSERT INTO device (" + | 
|---|
|  |  |  | "deviceId, " + | 
|---|
|  |  |  | 
|---|
|  |  |  | "updateTime," + | 
|---|
|  |  |  | "charset," + | 
|---|
|  |  |  | "ssrcCheck," + | 
|---|
|  |  |  | "asMessageChannel," + | 
|---|
|  |  |  | "geoCoordSys," + | 
|---|
|  |  |  | "treeType," + | 
|---|
|  |  |  | "online" + | 
|---|
|  |  |  | "online," + | 
|---|
|  |  |  | "mediaServerId" + | 
|---|
|  |  |  | ") VALUES (" + | 
|---|
|  |  |  | "#{deviceId}," + | 
|---|
|  |  |  | "#{name}," + | 
|---|
|  |  |  | 
|---|
|  |  |  | "#{updateTime}," + | 
|---|
|  |  |  | "#{charset}," + | 
|---|
|  |  |  | "#{ssrcCheck}," + | 
|---|
|  |  |  | "#{asMessageChannel}," + | 
|---|
|  |  |  | "#{geoCoordSys}," + | 
|---|
|  |  |  | "#{treeType}," + | 
|---|
|  |  |  | "#{online}" + | 
|---|
|  |  |  | "#{online}," + | 
|---|
|  |  |  | "#{mediaServerId}" + | 
|---|
|  |  |  | ")") | 
|---|
|  |  |  | void addCustomDevice(Device device); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("select count(1) as total, sum(online) as online from device") | 
|---|
|  |  |  | ResourceBaceInfo getOverview(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("select * from device") | 
|---|
|  |  |  | List<Device> getAll(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("select * from device where  asMessageChannel = 1") | 
|---|
|  |  |  | List<Device> queryDeviceWithAsMessageChannel(); | 
|---|
|  |  |  | } | 
|---|