临时提交

pull/1642/head
648540858 2024-07-10 10:51:35 +08:00
parent e73fb64283
commit bb609b7e09
10 changed files with 345 additions and 339 deletions

View File

@ -55,7 +55,7 @@ public interface CommonGBChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as gb_svc_time_support_mode\n" +
" coalesce(gb_svc_time_support_mode,svc_time_support_mode) as gb_svc_time_support_mode\n" +
"from wvp_device_channel\n" +
"where gb_device_id = #{gbDeviceId} or device_id = #{gbDeviceId}")
CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
@ -198,7 +198,7 @@ public interface CommonGBChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as gb_svc_time_support_mode\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel" +
" where id = #{gbId}")
CommonGBChannel queryById(@Param("gbId") int gbId);
@ -355,7 +355,7 @@ public interface CommonGBChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as gb_svc_time_support_mode\n" +
" coalesce(gb_svc_time_support_mode,svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel" +
" where gb_status=#{status} and id in " +
" <foreach collection='commonGBChannelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@ -471,7 +471,7 @@ public interface CommonGBChannelMapper {
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wdc.gb_svc_time_support_mode wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
" coalesce(wdc.gb_svc_time_support_mode,wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
"from wvp_device_channel wdc left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id\n" +
"where wpgc.platform_id = #{platformId}"})
List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId);

View File

@ -17,12 +17,12 @@ import java.util.List;
@Repository
public interface DeviceChannelMapper {
@Insert("INSERT INTO wvp_device_channel (device_id, device_db_id, name, manufacture, model, owner, civil_code, block, " +
@Insert("INSERT INTO wvp_device_channel (device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
"svc_time_support_mode, create_time, update_time, sub_countstream_id, has_audio, gps_time, stream_identification) " +
"VALUES (#{deviceId}, #{deviceDbId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," +
"VALUES (#{deviceId}, #{deviceDbId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}," +
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " +
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
"#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," +
@ -35,7 +35,7 @@ public interface DeviceChannelMapper {
", device_id=#{deviceId}" +
", device_db_id=#{deviceDbId}" +
", name=#{name}" +
", manufacture=#{manufacture}" +
", manufacturer#{manufacturer}" +
", model=#{model}" +
", owner=#{owner}" +
", civil_code=#{civilCode}" +
@ -118,55 +118,55 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
"SELECT " +
" dc.device_db_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
" dc.sub_count,\n" +
" dc.stream_id,\n" +
" dc.has_audio,\n" +
" dc.gps_time,\n" +
" dc.stream_identification,\n" +
" coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" +
" coalesce(dc.gb_name, dc.name) as name,\n" +
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
" coalesce(dc.gb_model, dc.model) as model,\n" +
" coalesce(dc.gb_owner, dc.owner) as owner,\n" +
" coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,\n" +
" coalesce(dc.gb_block, dc.block) as block,\n" +
" coalesce(dc.gb_address, dc.address) as address,\n" +
" coalesce(dc.gb_parental, dc.parental) as parental,\n" +
" coalesce(dc.gb_parent_id, dc.parent_id) as parent_id,\n" +
" coalesce(dc.gb_safety_way, dc.safety_way) as safety_way,\n" +
" coalesce(dc.gb_register_way, dc.register_way) as register_way,\n" +
" coalesce(dc.gb_cert_num, dc.cert_num) as cert_num,\n" +
" coalesce(dc.gb_certifiable, dc.certifiable) as certifiable,\n" +
" coalesce(dc.gb_err_code, dc.err_code) as err_code,\n" +
" coalesce(dc.gb_end_time, dc.end_time) as end_time,\n" +
" coalesce(dc.gb_secrecy, dc.secrecy) as secrecy,\n" +
" coalesce(dc.gb_ip_address, dc.ip_address) as ip_address,\n" +
" coalesce(dc.gb_port, dc.port) as port,\n" +
" coalesce(dc.gb_password, dc.password) as password,\n" +
" coalesce(dc.gb_status, dc.status) as status,\n" +
" coalesce(dc.gb_longitude, dc.longitude) as longitude,\n" +
" coalesce(dc.gb_latitude, dc.latitude) as latitude,\n" +
" coalesce(dc.gb_ptz_type, dc.ptz_type) as ptz_type,\n" +
" coalesce(dc.gb_position_type, dc.position_type) as position_type,\n" +
" coalesce(dc.gb_room_type, dc.room_type) as room_type,\n" +
" coalesce(dc.gb_use_type, dc.use_type) as use_type,\n" +
" coalesce(dc.gb_supply_light_type, dc.supply_light_type) as supply_light_type,\n" +
" coalesce(dc.gb_direction_type, dc.direction_type) as direction_type,\n" +
" coalesce(dc.gb_resolution, dc.resolution) as resolution,\n" +
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" +
" coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" +
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode dc.svc_time_support_mode) as svc_time_support_mode\n" +
" dc.device_db_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
" dc.sub_count,\n" +
" dc.stream_id,\n" +
" dc.has_audio,\n" +
" dc.gps_time,\n" +
" dc.stream_identification,\n" +
" coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" +
" coalesce(dc.gb_name, dc.name) as name,\n" +
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
" coalesce(dc.gb_model, dc.model) as model,\n" +
" coalesce(dc.gb_owner, dc.owner) as owner,\n" +
" coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,\n" +
" coalesce(dc.gb_block, dc.block) as block,\n" +
" coalesce(dc.gb_address, dc.address) as address,\n" +
" coalesce(dc.gb_parental, dc.parental) as parental,\n" +
" coalesce(dc.gb_parent_id, dc.parent_id) as parent_id,\n" +
" coalesce(dc.gb_safety_way, dc.safety_way) as safety_way,\n" +
" coalesce(dc.gb_register_way, dc.register_way) as register_way,\n" +
" coalesce(dc.gb_cert_num, dc.cert_num) as cert_num,\n" +
" coalesce(dc.gb_certifiable, dc.certifiable) as certifiable,\n" +
" coalesce(dc.gb_err_code, dc.err_code) as err_code,\n" +
" coalesce(dc.gb_end_time, dc.end_time) as end_time,\n" +
" coalesce(dc.gb_secrecy, dc.secrecy) as secrecy,\n" +
" coalesce(dc.gb_ip_address, dc.ip_address) as ip_address,\n" +
" coalesce(dc.gb_port, dc.port) as port,\n" +
" coalesce(dc.gb_password, dc.password) as password,\n" +
" coalesce(dc.gb_status, dc.status) as status,\n" +
" coalesce(dc.gb_longitude, dc.longitude) as longitude,\n" +
" coalesce(dc.gb_latitude, dc.latitude) as latitude,\n" +
" coalesce(dc.gb_ptz_type, dc.ptz_type) as ptz_type,\n" +
" coalesce(dc.gb_position_type, dc.position_type) as position_type,\n" +
" coalesce(dc.gb_room_type, dc.room_type) as room_type,\n" +
" coalesce(dc.gb_use_type, dc.use_type) as use_type,\n" +
" coalesce(dc.gb_supply_light_type, dc.supply_light_type) as supply_light_type,\n" +
" coalesce(dc.gb_direction_type, dc.direction_type) as direction_type,\n" +
" coalesce(dc.gb_resolution, dc.resolution) as resolution,\n" +
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" +
" coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" +
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
" from " +
" wvp_device_channel dc " +
" left join wvp_device d on d.id=dc.device_db_id" +
" WHERE " +
" d.device_id = #{deviceId} " +
" <if test='query != null'> AND (" +
"dc.channel_id LIKE concat('%',#{query},'%') " +
"dc.device_id LIKE concat('%',#{query},'%') " +
"OR dc.name LIKE concat('%',#{query},'%') " +
"OR dc.custom_name LIKE concat('%',#{query},'%')" +
")</if> " +
@ -178,55 +178,55 @@ public interface DeviceChannelMapper {
"<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " +
"</foreach> </if>" +
"ORDER BY dc.channel_id " +
"ORDER BY dc.device_id " +
" </script>"})
List<DeviceChannel> queryChannels(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@Select("select\n" +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode,svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel\n" +
"where device_db_id = #{deviceDbId}")
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId);
@ -242,7 +242,7 @@ public interface DeviceChannelMapper {
"LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
"WHERE 1=1" +
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc.status=1</if>" +
" <if test='online == false' > AND dc.status=0</if>" +
@ -251,53 +251,53 @@ public interface DeviceChannelMapper {
"<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " +
"</foreach> </if>" +
"ORDER BY dc.channel_id ASC" +
"ORDER BY dc.device_id ASC" +
" </script>"})
List<DeviceChannelExtend> queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@Select("SELECT " +
" dc.device_db_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
" dc.sub_count,\n" +
" dc.stream_id,\n" +
" dc.has_audio,\n" +
" dc.gps_time,\n" +
" dc.stream_identification,\n" +
" coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" +
" coalesce(dc.gb_name, dc.name) as name,\n" +
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
" coalesce(dc.gb_model, dc.model) as model,\n" +
" coalesce(dc.gb_owner, dc.owner) as owner,\n" +
" coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,\n" +
" coalesce(dc.gb_block, dc.block) as block,\n" +
" coalesce(dc.gb_address, dc.address) as address,\n" +
" coalesce(dc.gb_parental, dc.parental) as parental,\n" +
" coalesce(dc.gb_parent_id, dc.parent_id) as parent_id,\n" +
" coalesce(dc.gb_safety_way, dc.safety_way) as safety_way,\n" +
" coalesce(dc.gb_register_way, dc.register_way) as register_way,\n" +
" coalesce(dc.gb_cert_num, dc.cert_num) as cert_num,\n" +
" coalesce(dc.gb_certifiable, dc.certifiable) as certifiable,\n" +
" coalesce(dc.gb_err_code, dc.err_code) as err_code,\n" +
" coalesce(dc.gb_end_time, dc.end_time) as end_time,\n" +
" coalesce(dc.gb_secrecy, dc.secrecy) as secrecy,\n" +
" coalesce(dc.gb_ip_address, dc.ip_address) as ip_address,\n" +
" coalesce(dc.gb_port, dc.port) as port,\n" +
" coalesce(dc.gb_password, dc.password) as password,\n" +
" coalesce(dc.gb_status, dc.status) as status,\n" +
" coalesce(dc.gb_longitude, dc.longitude) as longitude,\n" +
" coalesce(dc.gb_latitude, dc.latitude) as latitude,\n" +
" coalesce(dc.gb_ptz_type, dc.ptz_type) as ptz_type,\n" +
" coalesce(dc.gb_position_type, dc.position_type) as position_type,\n" +
" coalesce(dc.gb_room_type, dc.room_type) as room_type,\n" +
" coalesce(dc.gb_use_type, dc.use_type) as use_type,\n" +
" coalesce(dc.gb_supply_light_type, dc.supply_light_type) as supply_light_type,\n" +
" coalesce(dc.gb_direction_type, dc.direction_type) as direction_type,\n" +
" coalesce(dc.gb_resolution, dc.resolution) as resolution,\n" +
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" +
" coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" +
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode dc.svc_time_support_mode) as svc_time_support_mode\n" +
" dc.device_db_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
" dc.sub_count,\n" +
" dc.stream_id,\n" +
" dc.has_audio,\n" +
" dc.gps_time,\n" +
" dc.stream_identification,\n" +
" coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" +
" coalesce(dc.gb_name, dc.name) as name,\n" +
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
" coalesce(dc.gb_model, dc.model) as model,\n" +
" coalesce(dc.gb_owner, dc.owner) as owner,\n" +
" coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,\n" +
" coalesce(dc.gb_block, dc.block) as block,\n" +
" coalesce(dc.gb_address, dc.address) as address,\n" +
" coalesce(dc.gb_parental, dc.parental) as parental,\n" +
" coalesce(dc.gb_parent_id, dc.parent_id) as parent_id,\n" +
" coalesce(dc.gb_safety_way, dc.safety_way) as safety_way,\n" +
" coalesce(dc.gb_register_way, dc.register_way) as register_way,\n" +
" coalesce(dc.gb_cert_num, dc.cert_num) as cert_num,\n" +
" coalesce(dc.gb_certifiable, dc.certifiable) as certifiable,\n" +
" coalesce(dc.gb_err_code, dc.err_code) as err_code,\n" +
" coalesce(dc.gb_end_time, dc.end_time) as end_time,\n" +
" coalesce(dc.gb_secrecy, dc.secrecy) as secrecy,\n" +
" coalesce(dc.gb_ip_address, dc.ip_address) as ip_address,\n" +
" coalesce(dc.gb_port, dc.port) as port,\n" +
" coalesce(dc.gb_password, dc.password) as password,\n" +
" coalesce(dc.gb_status, dc.status) as status,\n" +
" coalesce(dc.gb_longitude, dc.longitude) as longitude,\n" +
" coalesce(dc.gb_latitude, dc.latitude) as latitude,\n" +
" coalesce(dc.gb_ptz_type, dc.ptz_type) as ptz_type,\n" +
" coalesce(dc.gb_position_type, dc.position_type) as position_type,\n" +
" coalesce(dc.gb_room_type, dc.room_type) as room_type,\n" +
" coalesce(dc.gb_use_type, dc.use_type) as use_type,\n" +
" coalesce(dc.gb_supply_light_type, dc.supply_light_type) as supply_light_type,\n" +
" coalesce(dc.gb_direction_type, dc.direction_type) as direction_type,\n" +
" coalesce(dc.gb_resolution, dc.resolution) as resolution,\n" +
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" +
" coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" +
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
" FROM wvp_device_channel dc " +
" left join wvp_device d on d.id=dc.device_db_id" +
" WHERE d.device_id=#{deviceId} AND dc.device_id=#{channelId}")
@ -318,14 +318,14 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
"SELECT " +
" dc.id,\n" +
" COALESCE(dc.gb_device_id, dc.device_id) AS name,\n" +
" COALESCE(dc.gb_name, dc.name) AS name,\n" +
" COALESCE(dc.gb_manufacturer, dc.manufacturer) AS manufacturer,\n" +
" COALESCE(dc.gb_ip_address, dc.ip_address) AS ip_address,\n" +
" dc.sub_count,\n" +
" pgc.platform_id as platform_id,\n" +
" pgc.catalog_id as catalog_id " +
" dc.id,\n" +
" COALESCE(dc.gb_device_id, dc.device_id) AS name,\n" +
" COALESCE(dc.gb_name, dc.name) AS name,\n" +
" COALESCE(dc.gb_manufacturer, dc.manufacturer) AS manufacturer,\n" +
" COALESCE(dc.gb_ip_address, dc.ip_address) AS ip_address,\n" +
" dc.sub_count,\n" +
" pgc.platform_id as platform_id,\n" +
" pgc.catalog_id as catalog_id " +
" FROM wvp_device_channel dc " +
" LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
" LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
@ -345,49 +345,49 @@ public interface DeviceChannelMapper {
List<ChannelReduce> queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select("SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode,svc_time_support_mode) as svc_time_support_mode\n" +
" FROM wvp_device_channel WHERE device_id=#{channelId}")
List<DeviceChannel> queryChannelByChannelId(@Param("channelId") String channelId);
@ -396,14 +396,14 @@ public interface DeviceChannelMapper {
@Insert("<script> " +
"insert into wvp_device_channel " +
"(device_id, device_db_id, name, manufacture, model, owner, civil_code, block, " +
"(device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
"svc_time_support_mode, create_time, update_time, sub_countstream_id, has_audio, gps_time, stream_identification) " +
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification) " +
"values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.deviceId}, #{item.deviceDbId}, #{item.name}, #{item.manufacture}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
"(#{item.deviceId}, #{item.deviceDbId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " +
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
"#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," +
@ -424,7 +424,7 @@ public interface DeviceChannelMapper {
", device_id=#{item.deviceId}" +
", device_db_id=#{item.deviceDbId}" +
", name=#{item.name}" +
", manufacture=#{item.manufacture}" +
", manufacturer=#{item.manufacturer}" +
", model=#{item.model}" +
", owner=#{item.owner}" +
", civil_code=#{item.civilCode}" +
@ -461,16 +461,16 @@ public interface DeviceChannelMapper {
", has_audio=#{item.hasAudio}" +
", gps_time=#{item.gpsTime}" +
", stream_identification=#{item.streamIdentification}" +
"WHERE id=#{item.id}" +
" WHERE id=#{item.id}" +
"</foreach>" +
"</script>"})
int batchUpdate(List<DeviceChannel> updateChannels);
@Update(" update wvp_device_channel" +
" set sub_count = (select *" +
" from (select count(0)" +
" from wvp_device_channel" +
" where device_db_id = #{deviceDbId} and parent_id = #{channelId}) as temp)" +
" from (select count(0)" +
" from wvp_device_channel" +
" where device_db_id = #{deviceDbId} and parent_id = #{channelId}) as temp)" +
" where device_db_id = #{deviceDbId} and device_id = #{channelId}")
int updateChannelSubCount(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
@ -485,53 +485,53 @@ public interface DeviceChannelMapper {
int updatePosition(DeviceChannel deviceChannel);
@Select("select " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
" from wvp_device_channel where device_db_id = #{deviceDbId}")
List<DeviceChannel> queryAllChannels(@Param("deviceDbId") int deviceDbId);
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.channel_id=#{channelId}")
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.device_id=#{channelId}")
List<Device> getDeviceByChannelId(String channelId);
@ -565,49 +565,49 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
"SELECT " +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
" id,\n" +
" device_db_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" stream_id,\n" +
" has_audio,\n" +
" gps_time,\n" +
" stream_identification,\n" +
" coalesce(gb_device_id, device_id) as device_id,\n" +
" coalesce(gb_name, name) as name,\n" +
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
" coalesce(gb_model, model) as model,\n" +
" coalesce(gb_owner, owner) as owner,\n" +
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
" coalesce(gb_block, block) as block,\n" +
" coalesce(gb_address, address) as address,\n" +
" coalesce(gb_parental, parental) as parental,\n" +
" coalesce(gb_parent_id, parent_id) as parent_id,\n" +
" coalesce(gb_safety_way, safety_way) as safety_way,\n" +
" coalesce(gb_register_way, register_way) as register_way,\n" +
" coalesce(gb_cert_num, cert_num) as cert_num,\n" +
" coalesce(gb_certifiable, certifiable) as certifiable,\n" +
" coalesce(gb_err_code, err_code) as err_code,\n" +
" coalesce(gb_end_time, end_time) as end_time,\n" +
" coalesce(gb_secrecy, secrecy) as secrecy,\n" +
" coalesce(gb_ip_address, ip_address) as ip_address,\n" +
" coalesce(gb_port, port) as port,\n" +
" coalesce(gb_password, password) as password,\n" +
" coalesce(gb_status, status) as status,\n" +
" coalesce(gb_longitude, longitude) as longitude,\n" +
" coalesce(gb_latitude, latitude) as latitude,\n" +
" coalesce(gb_ptz_type, ptz_type) as ptz_type,\n" +
" coalesce(gb_position_type, position_type) as position_type,\n" +
" coalesce(gb_room_type, room_type) as room_type,\n" +
" coalesce(gb_use_type, use_type) as use_type,\n" +
" coalesce(gb_supply_light_type, supply_light_type) as supply_light_type,\n" +
" coalesce(gb_direction_type, direction_type) as direction_type,\n" +
" coalesce(gb_resolution, resolution) as resolution,\n" +
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel " +
"where device_db_id=#{deviceDbId}" +
" <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +

View File

@ -15,6 +15,7 @@ import java.util.List;
public interface DeviceMapper {
@Select("SELECT " +
"id, " +
"device_id, " +
"coalesce(custom_name, name) as name, " +
"password, " +
@ -44,8 +45,8 @@ public interface DeviceMapper {
"on_line," +
"media_server_id," +
"broadcast_push_after_ack," +
"(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+
" FROM wvp_device WHERE device_id = #{deviceId}")
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count "+
" FROM wvp_device de WHERE de.device_id = #{deviceId}")
Device getDeviceByDeviceId(String deviceId);
@Insert("INSERT INTO wvp_device (" +
@ -133,6 +134,7 @@ public interface DeviceMapper {
@Select(
" <script>" +
"SELECT " +
"id, " +
"device_id, " +
"coalesce(custom_name, name) as name, " +
"password, " +
@ -162,10 +164,10 @@ public interface DeviceMapper {
"geo_coord_sys,"+
"on_line,"+
"media_server_id,"+
"(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count " +
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " +
"FROM wvp_device de" +
"<if test=\"onLine != null\"> where on_line=${onLine}</if>"+
" order by create_time desc "+
"<if test=\"onLine != null\"> where de.on_line=${onLine}</if>"+
" order by de.create_time desc "+
" </script>"
)
List<Device> getDevices(Boolean onLine);
@ -174,6 +176,7 @@ public interface DeviceMapper {
int del(String deviceId);
@Select("SELECT " +
"id, " +
"device_id, " +
"coalesce(custom_name, name) as name, " +
"password, " +
@ -204,7 +207,9 @@ public interface DeviceMapper {
"on_line"+
" FROM wvp_device WHERE on_line = true")
List<Device> getOnlineDevices();
@Select("SELECT " +
"id,"+
"device_id,"+
"coalesce(custom_name,name)as name,"+
"password,"+

View File

@ -117,6 +117,6 @@ public interface PlatformChannelMapper {
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId}")
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.device_id=#{channelId}")
List<String> queryParentPlatformByChannelId(@Param("channelId") String channelId);
}

View File

@ -106,7 +106,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
if (deviceListIterator != null) {
List<DeviceChannel> channelList = new ArrayList<>();
List<String> parentChannelIds = new ArrayList<>();
// 遍历DeviceList
while (deviceListIterator.hasNext()) {
Element itemDevice = deviceListIterator.next();
@ -115,16 +114,14 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
continue;
}
DeviceChannel channel = DeviceChannel.decode(itemDevice);
// DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, null);
if (channel == null || channel.getDeviceId() == null) {
log.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;
}
channel.setDeviceDbId(device.getId());
if (channel.getParentId() != null && channel.getParentId().equals(sipConfig.getId())) {
channel.setParentId(null);
}
channel.setDeviceId(take.getDevice().getDeviceId());
channelList.add(channel);
}
int sn = Integer.parseInt(snElement.getText());

View File

@ -9,15 +9,15 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.service.IDeviceChannelService;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
@ -31,7 +31,6 @@ import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* @author lin
@ -90,7 +89,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
List<DeviceChannel> addChannels = new ArrayList<>();
List<DeviceChannel> updateChannels = new ArrayList<>();
HashMap<String, DeviceChannel> channelsInStore = new HashMap<>();
if (channels != null && channels.size() > 0) {
if (channels != null && !channels.isEmpty()) {
List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId());
if (channelList.isEmpty()) {
for (DeviceChannel channel : channels) {
@ -106,17 +105,18 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
}else {
for (DeviceChannel deviceChannel : channelList) {
channelsInStore.put(deviceChannel.getDeviceId(), deviceChannel);
channelsInStore.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
}
for (DeviceChannel channel : channels) {
channel.setDeviceDbId(device.getId());
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getDeviceId());
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
}
String now = DateUtil.getNow();
channel.setUpdateTime(now);
if (channelsInStore.get(channel.getDeviceId()) != null) {
DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDeviceDbId() + channel.getDeviceId());
if ( deviceChannelInDb != null) {
channel.setId(deviceChannelInDb.getId());
updateChannels.add(channel);
}else {
addChannels.add(channel);
@ -399,9 +399,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
List<DeviceChannel> allChannels = channelMapper.queryAllChannels(device.getId());
Map<String,DeviceChannel> allChannelMap = new ConcurrentHashMap<>();
if (allChannels.size() > 0) {
if (!allChannels.isEmpty()) {
for (DeviceChannel deviceChannel : allChannels) {
allChannelMap.put(deviceChannel.getDeviceId(), deviceChannel);
allChannelMap.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
}
}
// 数据去重
@ -421,17 +421,18 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
continue;
}
gbIdSet.add(deviceChannel.getDeviceId());
if (allChannelMap.containsKey(deviceChannel.getDeviceId())) {
deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getDeviceId()).getStreamId());
deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getDeviceId()).getHasAudio());
if (allChannelMap.get(deviceChannel.getDeviceId()).getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
DeviceChannel channelInDb = allChannelMap.get(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
if (channelInDb != null) {
deviceChannel.setStreamId(channelInDb.getStreamId());
deviceChannel.setHasAudio(channelInDb.getHasAudio());
deviceChannel.setId(channelInDb.getId());
if (channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
if (!CollectionUtils.isEmpty(strings)){
strings.forEach(platformId->{
eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.getStatus().equals("ON")? CatalogEvent.ON:CatalogEvent.OFF);
});
}
}
deviceChannel.setUpdateTime(DateUtil.getNow());
updateChannels.add(deviceChannel);
@ -440,7 +441,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
deviceChannel.setUpdateTime(DateUtil.getNow());
addChannels.add(deviceChannel);
}
allChannelMap.remove(deviceChannel.getDeviceId());
allChannelMap.remove(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
channels.add(deviceChannel);
if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
if (subContMap.get(deviceChannel.getParentId()) == null) {

View File

@ -62,6 +62,9 @@ public class StreamProxy extends CommonGBChannel {
@Schema(description = "拉流代理时zlm返回的key用于停止拉流代理")
private String streamKey;
@Schema(description = "拉流状态")
private Boolean status;
@Schema(description = "更新时间")
private String updateTime;

View File

@ -88,12 +88,25 @@ public interface StreamProxyMapper {
@Select("select count(1) from wvp_stream_proxy where status = true")
int getOnline();
/**
*
*/
List<StreamProxy> selectWithAutoRemoveAndWithoutGbDeviceIdByMediaServerId(String mediaServerId);
int delete(int id);
@Delete("DELETE FROM wvp_stream_proxy WHERE id=#{id}")
int delete(@Param("id") int id);
@Delete(value = "<script>" +
"DELETE FROM wvp_stream_proxy WHERE id in (" +
"<foreach collection='streamProxiesForRemove' index='index' item='item' separator=','> " +
"#{item.id}"+
"</foreach>" +
")" +
"</script>")
void deleteByList(List<StreamProxy> streamProxiesForRemove);
@Update("UPDATE wvp_stream_proxy " +
"SET status=true " +
"WHERE id=#{id}")
int online(@Param("id") int id);
@Update("UPDATE wvp_stream_proxy " +
"SET status=false " +
"WHERE id=#{id}")
int offline(@Param("id") int id);
}

View File

@ -3,13 +3,11 @@ package com.genersoft.iot.vmp.streamProxy.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent;
import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent;
@ -18,8 +16,6 @@ import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerOnlineEvent;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.gb28181.dao.PlatformGbStreamMapper;
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
@ -57,27 +53,15 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private IVideoManagerStorage storager;
@Autowired
private UserSetting userSetting;
@Autowired
private IGbChannelService gbChannelService;
@Autowired
private PlatformGbStreamMapper platformGbStreamMapper;
@Autowired
private IMediaServerService mediaServerService;
@Autowired
private HookSubscribe hookSubscribe;
@Autowired
private DynamicTask dynamicTask;
@Autowired
DataSourceTransactionManager dataSourceTransactionManager;
@ -407,16 +391,18 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Transactional
public int updateStatusByAppAndStream(String app, String stream, boolean status) {
// 状态变化时推送到国标上级
StreamProxy streamProxyItem = streamProxyMapper.selectOne(app, stream);
if (streamProxyItem == null) {
StreamProxy streamProxy = streamProxyMapper.selectOne(app, stream);
if (streamProxy == null) {
return 0;
}
streamProxyItem.setGbStatus(status?1:0);
if (streamProxyItem.getGbId() > 0) {
streamProxy.setStatus(true);
streamProxyMapper.online(streamProxy.getId());
streamProxy.setGbStatus(status?1:0);
if (streamProxy.getGbId() > 0) {
if (status) {
gbChannelService.online(streamProxyItem.getCommonGBChannel());
gbChannelService.online(streamProxy.getCommonGBChannel());
}else {
gbChannelService.offline(streamProxyItem.getCommonGBChannel());
gbChannelService.offline(streamProxy.getCommonGBChannel());
}
}

View File

@ -292,6 +292,7 @@ create table wvp_stream_proxy (
media_server_id character varying(50),
enable_audio bool default false,
enable_mp4 bool default false,
status bool default false,
enable bool default false,
enable_remove_none_reader bool default false,
create_time character varying(50),