|  |  |  | 
|---|
|  |  |  | @Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) | 
|---|
|  |  |  | void startPlay(String deviceId, String channelId, String streamId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select(value = {" <script>" + | 
|---|
|  |  |  | "SELECT dc.channelId, "+ | 
|---|
|  |  |  | "dc.deviceId, " + | 
|---|
|  |  |  | "dc.name, " + | 
|---|
|  |  |  | "de.manufacturer, " + | 
|---|
|  |  |  | "de.hostAddress, " + | 
|---|
|  |  |  | "dc.subCount, " + | 
|---|
|  |  |  | "pgc.platformId as platformId, " + | 
|---|
|  |  |  | "pgc.catalogId as catalogId " + | 
|---|
|  |  |  | "FROM device_channel dc " + | 
|---|
|  |  |  | "LEFT JOIN device de ON dc.deviceId = de.deviceId " + | 
|---|
|  |  |  | "LEFT JOIN platform_gb_channel pgc on de.deviceId = pgc.deviceId and pgc.channelId = dc.channelId " + | 
|---|
|  |  |  | "LEFT JOIN device_channel dc2 ON dc2.deviceId = de.deviceId AND dc2.parentId = dc.channelId " + | 
|---|
|  |  |  | "SELECT " + | 
|---|
|  |  |  | "    dc.id,\n" + | 
|---|
|  |  |  | "    dc.channelId,\n" + | 
|---|
|  |  |  | "    dc.deviceId,\n" + | 
|---|
|  |  |  | "    dc.name,\n" + | 
|---|
|  |  |  | "    de.manufacturer,\n" + | 
|---|
|  |  |  | "    de.hostAddress,\n" + | 
|---|
|  |  |  | "    dc.subCount,\n" + | 
|---|
|  |  |  | "    pgc.platformId as platformId,\n" + | 
|---|
|  |  |  | "    pgc.catalogId as catalogId " + | 
|---|
|  |  |  | " FROM device_channel dc " + | 
|---|
|  |  |  | " LEFT JOIN device de ON dc.deviceId = de.deviceId " + | 
|---|
|  |  |  | " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " + | 
|---|
|  |  |  | " WHERE 1=1 " + | 
|---|
|  |  |  | " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + | 
|---|
|  |  |  | " <if test='online == true' > AND dc.status=1</if> " + | 
|---|
|  |  |  | " <if test='online == false' > AND dc.status=0</if> " + | 
|---|
|  |  |  | " <if test='hasSubChannel!= null and hasSubChannel == true' >  AND dc2.channelId is not null</if> " + | 
|---|
|  |  |  | " <if test='hasSubChannel!= null and hasSubChannel == false' >  AND dc2.channelId is null</if> " + | 
|---|
|  |  |  | " <if test='catalogId == null ' >  AND pgc.platformId is null AND pgc.catalogId is null</if> " + | 
|---|
|  |  |  | " <if test='catalogId != null ' >  AND pgc.platformId =#{platformId} AND pgc.catalogId = #{catalogId}</if> " + | 
|---|
|  |  |  | " <if test='hasSubChannel!= null and hasSubChannel == true' >  AND dc.subCount > 0</if> " + | 
|---|
|  |  |  | " <if test='hasSubChannel!= null and hasSubChannel == false' >  AND dc.subCount == 0</if> " + | 
|---|
|  |  |  | " <if test='catalogId == null ' >  AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " + | 
|---|
|  |  |  | " <if test='catalogId != null ' >  AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " + | 
|---|
|  |  |  | " ORDER BY dc.deviceId, dc.channelId ASC" + | 
|---|
|  |  |  | " </script>"}) | 
|---|
|  |  |  | List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); | 
|---|
|  |  |  | 
|---|
|  |  |  | "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " + | 
|---|
|  |  |  | "'${item.streamId}', ${item.longitude}, ${item.latitude},'${item.createTime}', '${item.updateTime}')" + | 
|---|
|  |  |  | "</foreach> " + | 
|---|
|  |  |  | "ON DUPLICATE KEY UPDATE " + | 
|---|
|  |  |  | "updateTime=VALUES(updateTime), " + | 
|---|
|  |  |  | "name=VALUES(name), " + | 
|---|
|  |  |  | "manufacture=VALUES(manufacture), " + | 
|---|
|  |  |  | "model=VALUES(model), " + | 
|---|
|  |  |  | "owner=VALUES(owner), " + | 
|---|
|  |  |  | "civilCode=VALUES(civilCode), " + | 
|---|
|  |  |  | "block=VALUES(block), " + | 
|---|
|  |  |  | "subCount=VALUES(subCount), " + | 
|---|
|  |  |  | "address=VALUES(address), " + | 
|---|
|  |  |  | "parental=VALUES(parental), " + | 
|---|
|  |  |  | "parentId=VALUES(parentId), " + | 
|---|
|  |  |  | "safetyWay=VALUES(safetyWay), " + | 
|---|
|  |  |  | "registerWay=VALUES(registerWay), " + | 
|---|
|  |  |  | "certNum=VALUES(certNum), " + | 
|---|
|  |  |  | "certifiable=VALUES(certifiable), " + | 
|---|
|  |  |  | "errCode=VALUES(errCode), " + | 
|---|
|  |  |  | "secrecy=VALUES(secrecy), " + | 
|---|
|  |  |  | "ipAddress=VALUES(ipAddress), " + | 
|---|
|  |  |  | "port=VALUES(port), " + | 
|---|
|  |  |  | "password=VALUES(password), " + | 
|---|
|  |  |  | "PTZType=VALUES(PTZType), " + | 
|---|
|  |  |  | "status=VALUES(status), " + | 
|---|
|  |  |  | "streamId=VALUES(streamId), " + | 
|---|
|  |  |  | "longitude=VALUES(longitude), " + | 
|---|
|  |  |  | "latitude=VALUES(latitude)" + | 
|---|
|  |  |  | "</script>") | 
|---|
|  |  |  | int batchAdd(List<DeviceChannel> addChannels); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select(" SELECT\n" + | 
|---|
|  |  |  | "        id,\n" + | 
|---|
|  |  |  | "        channelId,\n" + | 
|---|
|  |  |  | "        channelId as id,\n" + | 
|---|
|  |  |  | "        deviceId,\n" + | 
|---|
|  |  |  | "        parentId,\n" + | 
|---|
|  |  |  | "        status,\n" + | 
|---|
|  |  |  | "        name as title,\n" + | 
|---|
|  |  |  | "        channelId as \"value\",\n" + | 
|---|
|  |  |  | "        channelId as \"key\",\n" + | 
|---|
|  |  |  | "        channelId,\n" + | 
|---|
|  |  |  | "        longitude,\n" + | 
|---|
|  |  |  | "        latitude\n" + | 
|---|
|  |  |  | "        from device_channel\n" + | 
|---|
|  |  |  | "        where deviceId = #{deviceId}") | 
|---|
|  |  |  | List<DeviceChannelTree> tree(String deviceId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Delete(value = {" <script>" + | 
|---|
|  |  |  | "DELETE " + | 
|---|
|  |  |  | "from " + | 
|---|
|  |  |  | "device_channel " + | 
|---|
|  |  |  | "WHERE " + | 
|---|
|  |  |  | "deviceId = #{deviceId} " + | 
|---|
|  |  |  | " AND channelId NOT IN " + | 
|---|
|  |  |  | "<foreach collection='channels'  item='item'  open='(' separator=',' close=')' > #{item.channelId}</foreach>" + | 
|---|
|  |  |  | " </script>"}) | 
|---|
|  |  |  | int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Update(" update device_channel" + | 
|---|
|  |  |  | " set subCount = (select *" + | 
|---|
|  |  |  | "                from (select count(0)" + | 
|---|
|  |  |  | "                      from device_channel" + | 
|---|
|  |  |  | "                      where deviceId = #{deviceId} and parentId = #{channelId}) as temp)" + | 
|---|
|  |  |  | " where deviceId = #{deviceId} " + | 
|---|
|  |  |  | " and channelId = #{channelId}") | 
|---|
|  |  |  | int updateChannelSubCount(String deviceId, String channelId); | 
|---|
|  |  |  | } | 
|---|