Merge 7fa4dc46e9
into 464c989986
commit
0e9a6f1142
src/main
java/com/genersoft/iot/vmp
streamProxy/dao
streamPush/dao
resources/mapper
|
@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
@ -53,6 +55,8 @@ public class MybatisConfig {
|
|||
if (userSetting.getSqlLog()){
|
||||
config.setLogImpl(StdOutImpl.class);
|
||||
}
|
||||
Resource[] resources = new PathMatchingResourcePatternResolver().getResources("classpath:mapper/**/*Mapper.xml");
|
||||
sqlSessionFactory.setMapperLocations(resources);
|
||||
config.setMapUnderscoreToCamelCase(true);
|
||||
sqlSessionFactory.setConfiguration(config);
|
||||
sqlSessionFactory.setDatabaseIdProvider(databaseIdProvider);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.genersoft.iot.vmp.gb28181.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -13,535 +14,101 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface CommonGBChannelMapper {
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByDeviceId")
|
||||
CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
|
||||
|
||||
@Insert(" <script>" +
|
||||
"INSERT INTO wvp_device_channel (" +
|
||||
"gb_device_id," +
|
||||
"data_type," +
|
||||
"data_device_id," +
|
||||
"create_time," +
|
||||
"update_time," +
|
||||
"gb_name," +
|
||||
"gb_manufacturer," +
|
||||
"gb_model," +
|
||||
"gb_owner," +
|
||||
"gb_civil_code," +
|
||||
"gb_block," +
|
||||
"gb_address," +
|
||||
"gb_parental," +
|
||||
"gb_parent_id ," +
|
||||
"gb_safety_way," +
|
||||
"gb_register_way," +
|
||||
"gb_cert_num," +
|
||||
"gb_certifiable," +
|
||||
"gb_err_code," +
|
||||
"gb_end_time," +
|
||||
"gb_secrecy," +
|
||||
"gb_ip_address," +
|
||||
"gb_port," +
|
||||
"gb_password," +
|
||||
"gb_status," +
|
||||
"gb_longitude," +
|
||||
"gb_latitude," +
|
||||
"gb_ptz_type," +
|
||||
"gb_position_type," +
|
||||
"gb_room_type," +
|
||||
"gb_use_type," +
|
||||
"gb_supply_light_type," +
|
||||
"gb_direction_type," +
|
||||
"gb_resolution," +
|
||||
"gb_business_group_id," +
|
||||
"gb_download_speed," +
|
||||
"gb_svc_space_support_mod," +
|
||||
"gb_svc_time_support_mode ) " +
|
||||
"VALUES (" +
|
||||
"#{gbDeviceId}, " +
|
||||
"#{dataType}, " +
|
||||
"#{dataDeviceId}, " +
|
||||
"#{createTime}, " +
|
||||
"#{updateTime}, " +
|
||||
"#{gbName}, " +
|
||||
"#{gbManufacturer}, " +
|
||||
"#{gbModel}, " +
|
||||
"#{gbOwner}, " +
|
||||
"#{gbCivilCode}, " +
|
||||
"#{gbBlock}, " +
|
||||
"#{gbAddress}, " +
|
||||
"#{gbParental}, " +
|
||||
"#{gbParentId}, " +
|
||||
"#{gbSafetyWay}, " +
|
||||
"#{gbRegisterWay}, " +
|
||||
"#{gbCertNum}, " +
|
||||
"#{gbCertifiable}, " +
|
||||
"#{gbErrCode}, " +
|
||||
"#{gbEndTime}, " +
|
||||
"#{gbSecrecy},"+
|
||||
"#{gbIpAddress},"+
|
||||
"#{gbPort},"+
|
||||
"#{gbPassword},"+
|
||||
"#{gbStatus},"+
|
||||
"#{gbLongitude},"+
|
||||
"#{gbLatitude},"+
|
||||
"#{gbPtzType},"+
|
||||
"#{gbPositionType},"+
|
||||
"#{gbRoomType},"+
|
||||
"#{gbUseType},"+
|
||||
"#{gbSupplyLightType},"+
|
||||
"#{gbDirectionType},"+
|
||||
"#{gbResolution},"+
|
||||
"#{gbBusinessGroupId},"+
|
||||
"#{gbDownloadSpeed},"+
|
||||
"#{gbSvcSpaceSupportMod},"+
|
||||
"#{gbSvcTimeSupportMode}"+
|
||||
")" +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "gbId", keyColumn = "id")
|
||||
int insert(CommonGBChannel commonGBChannel);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryById")
|
||||
CommonGBChannel queryById(@Param("gbId") int gbId);
|
||||
|
||||
@Delete(value = {"delete from wvp_device_channel where id = #{gbId} "})
|
||||
void delete(int gbId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device_channel " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
", gb_device_id = #{gbDeviceId}" +
|
||||
", gb_name = #{gbName}" +
|
||||
", gb_manufacturer = #{gbManufacturer}" +
|
||||
", gb_model = #{gbModel}" +
|
||||
", gb_owner = #{gbOwner}" +
|
||||
", gb_civil_code = #{gbCivilCode}" +
|
||||
", gb_block = #{gbBlock}" +
|
||||
", gb_address = #{gbAddress}" +
|
||||
", gb_parental = #{gbParental}" +
|
||||
", gb_parent_id = #{gbParentId}" +
|
||||
", gb_safety_way = #{gbSafetyWay}" +
|
||||
", gb_register_way = #{gbRegisterWay}" +
|
||||
", gb_cert_num = #{gbCertNum}" +
|
||||
", gb_certifiable = #{gbCertifiable}" +
|
||||
", gb_err_code = #{gbErrCode}" +
|
||||
", gb_end_time = #{gbEndTime}" +
|
||||
", gb_ip_address = #{gbIpAddress}" +
|
||||
", gb_port = #{gbPort}" +
|
||||
", gb_password = #{gbPassword}" +
|
||||
", gb_status = #{gbStatus}" +
|
||||
", gb_longitude = #{gbLongitude}" +
|
||||
", gb_latitude = #{gbLatitude}" +
|
||||
", gb_ptz_type = #{gbPtzType}" +
|
||||
", gb_position_type = #{gbPositionType}" +
|
||||
", gb_room_type = #{gbRoomType}" +
|
||||
", gb_use_type = #{gbUseType}" +
|
||||
", gb_supply_light_type = #{gbSupplyLightType}" +
|
||||
", gb_direction_type = #{gbDirectionType}" +
|
||||
", gb_resolution = #{gbResolution}" +
|
||||
", gb_business_group_id = #{gbBusinessGroupId}" +
|
||||
", gb_download_speed = #{gbDownloadSpeed}" +
|
||||
", gb_svc_space_support_mod = #{gbSvcSpaceSupportMod}" +
|
||||
", gb_svc_time_support_mode = #{gbSvcTimeSupportMode}" +
|
||||
" WHERE id = #{gbId}"+
|
||||
" </script>"})
|
||||
int update(CommonGBChannel commonGBChannel);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_status = #{status}" +
|
||||
" WHERE id = #{gbId}"+
|
||||
" </script>"})
|
||||
int updateStatusById(@Param("gbId") int gbId, @Param("status") String status);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET gb_status = #{status} WHERE id = #{item.gbId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
int updateStatusForListById(List<CommonGBChannel> commonGBChannels, @Param("status") String status);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryInListByStatus")
|
||||
List<CommonGBChannel> queryInListByStatus(List<CommonGBChannel> commonGBChannelList, @Param("status") String status);
|
||||
|
||||
|
||||
@Insert(" <script>" +
|
||||
"INSERT INTO wvp_device_channel (" +
|
||||
"gb_device_id," +
|
||||
"data_type, " +
|
||||
"data_device_id," +
|
||||
"create_time," +
|
||||
"update_time," +
|
||||
"gb_name," +
|
||||
"gb_manufacturer," +
|
||||
"gb_model," +
|
||||
"gb_owner," +
|
||||
"gb_civil_code," +
|
||||
"gb_block," +
|
||||
"gb_address," +
|
||||
"gb_parental," +
|
||||
"gb_parent_id ," +
|
||||
"gb_safety_way," +
|
||||
"gb_register_way," +
|
||||
"gb_cert_num," +
|
||||
"gb_certifiable," +
|
||||
"gb_err_code," +
|
||||
"gb_end_time," +
|
||||
"gb_secrecy," +
|
||||
"gb_ip_address," +
|
||||
"gb_port," +
|
||||
"gb_password," +
|
||||
"gb_status," +
|
||||
"gb_longitude," +
|
||||
"gb_latitude," +
|
||||
"gb_ptz_type," +
|
||||
"gb_position_type," +
|
||||
"gb_room_type," +
|
||||
"gb_use_type," +
|
||||
"gb_supply_light_type," +
|
||||
"gb_direction_type," +
|
||||
"gb_resolution," +
|
||||
"gb_business_group_id," +
|
||||
"gb_download_speed," +
|
||||
"gb_svc_space_support_mod," +
|
||||
"gb_svc_time_support_mode ) " +
|
||||
"VALUES" +
|
||||
"<foreach collection='commonGBChannels' index='index' item='item' separator=','> " +
|
||||
"(#{item.gbDeviceId}, #{item.dataType}, #{item.dataDeviceId},#{item.createTime},#{item.updateTime}," +
|
||||
"#{item.gbName},#{item.gbManufacturer}, #{item.gbModel}," +
|
||||
"#{item.gbOwner},#{item.gbCivilCode},#{item.gbBlock}, #{item.gbAddress}, #{item.gbParental}, #{item.gbParentId},#{item.gbSafetyWay}, " +
|
||||
"#{item.gbRegisterWay},#{item.gbCertNum},#{item.gbCertifiable},#{item.gbErrCode},#{item.gbEndTime}, #{item.gbSecrecy},#{item.gbIpAddress}," +
|
||||
"#{item.gbPort},#{item.gbPassword},#{item.gbStatus},#{item.gbLongitude}, #{item.gbLatitude},#{item.gbPtzType},#{item.gbPositionType},#{item.gbRoomType}," +
|
||||
"#{item.gbUseType},#{item.gbSupplyLightType},#{item.gbDirectionType},#{item.gbResolution},#{item.gbBusinessGroupId},#{item.gbDownloadSpeed}," +
|
||||
"#{item.gbSvcSpaceSupportMod},#{item.gbSvcTimeSupportMode})" +
|
||||
"</foreach> " +
|
||||
" </script>")
|
||||
int batchAdd(List<CommonGBChannel> commonGBChannels);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET gb_status = #{item.gbStatus} WHERE id = #{item.gbId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
int updateStatus(List<CommonGBChannel> commonGBChannels);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET update_time=#{updateTime}, gb_device_id = null, gb_name = null, gb_manufacturer = null," +
|
||||
" gb_model = null, gb_owner = null, gb_block = null, gb_address = null," +
|
||||
" gb_parental = null, gb_parent_id = null, gb_safety_way = null, gb_register_way = null, gb_cert_num = null," +
|
||||
" gb_certifiable = null, gb_err_code = null, gb_end_time = null, gb_secrecy = null, gb_ip_address = null, " +
|
||||
" gb_port = null, gb_password = null, gb_status = null, gb_longitude = null, gb_latitude = null, " +
|
||||
" gb_ptz_type = null, gb_position_type = null, gb_room_type = null, gb_use_type = null, gb_supply_light_type = null, " +
|
||||
" gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
|
||||
" gb_svc_time_support_mode = null" +
|
||||
" WHERE id = #{id} and data_type = #{dataType} and data_device_id = #{dataDeviceId}"+
|
||||
" </script>"})
|
||||
void reset(@Param("id") int id, @Param("dataType") Integer dataType, @Param("dataDeviceId") int dataDeviceId, @Param("updateTime") String updateTime);
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByIds")
|
||||
List<CommonGBChannel> queryByIds(Collection<Integer> ids);
|
||||
|
||||
@Delete(value = {" <script>" +
|
||||
" delete from wvp_device_channel" +
|
||||
" where 1 = 1 and id in " +
|
||||
" <foreach collection='channelListInDb' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
"</script>"})
|
||||
void batchDelete(List<CommonGBChannel> channelListInDb);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode")
|
||||
List<CommonGBChannel> queryListByCivilCode(@Param("query") String query, @Param("online") Boolean online,
|
||||
@Param("dataType") Integer dataType, @Param("civilCode") String civilCode);
|
||||
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListByParentId")
|
||||
List<CommonGBChannel> queryListByParentId(@Param("query") String query, @Param("online") Boolean online,
|
||||
@Param("dataType") Integer dataType, @Param("groupDeviceId") String groupDeviceId);
|
||||
|
||||
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" id," +
|
||||
" concat('channel', id) as tree_id," +
|
||||
" coalesce(gb_device_id, device_id) as device_id," +
|
||||
" coalesce(gb_name, name) as name, " +
|
||||
" coalesce(gb_parent_id, parent_id) as parent_device_id, " +
|
||||
" coalesce(gb_status, status) as status, " +
|
||||
" 1 as type, " +
|
||||
" true as is_leaf " +
|
||||
" from wvp_device_channel " +
|
||||
" where coalesce(gb_civil_code, civil_code) = #{parentDeviceId} " +
|
||||
" <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<RegionTree> queryForRegionTreeByCivilCode(@Param("query") String query, @Param("parentDeviceId") String parentDeviceId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_civil_code = null, civil_code = null" +
|
||||
" WHERE gb_civil_code in "+
|
||||
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" </script>"})
|
||||
int removeCivilCode(List<Region> allChildren);
|
||||
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_civil_code = #{civilCode}" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int updateRegion(@Param("civilCode") String civilCode, @Param("channelList") List<CommonGBChannel> channelList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByIdsOrCivilCode")
|
||||
List<CommonGBChannel> queryByIdsOrCivilCode(@Param("civilCode") String civilCode, @Param("ids") List<Integer> ids);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_civil_code = null, civil_code = null" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int removeCivilCodeByChannels(List<CommonGBChannel> channelList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByCivilCode")
|
||||
List<CommonGBChannel> queryByCivilCode(@Param("civilCode") String civilCode);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds")
|
||||
List<CommonGBChannel> queryByGbDeviceIds(@Param("dataType") Integer dataType, List<Integer> deviceIds);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" select id from wvp_device_channel " +
|
||||
" where channel_type = 0 and data_type = #{dataType} and data_device_id in "+
|
||||
" <foreach collection='deviceIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>"})
|
||||
List<Integer> queryByGbDeviceIdsForIds(@Param("dataType") Integer dataType, List<Integer> deviceIds);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByGroupList")
|
||||
List<CommonGBChannel> queryByGroupList(List<Group> groupList);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int removeParentIdByChannels(List<CommonGBChannel> channelList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByBusinessGroup")
|
||||
List<CommonGBChannel> queryByBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByParentId")
|
||||
List<CommonGBChannel> queryByParentId(@Param("parentId") String parentId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_business_group_id = #{businessGroup}" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int updateBusinessGroupByChannelList(@Param("businessGroup") String businessGroup, List<CommonGBChannel> channelList);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_parent_id = #{parentId}" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int updateParentIdByChannelList(@Param("parentId") String parentId, List<CommonGBChannel> channelList);
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" id," +
|
||||
" concat('channel', id) as tree_id," +
|
||||
" coalesce(gb_device_id, device_id) as device_id," +
|
||||
" coalesce(gb_name, name) as name, " +
|
||||
" coalesce(gb_parent_id, parent_id) as parent_device_id, " +
|
||||
" coalesce(gb_business_group_id, business_group_id) as business_group, " +
|
||||
" coalesce(gb_status, status) as status, " +
|
||||
" 1 as type, " +
|
||||
" true as is_leaf " +
|
||||
" from wvp_device_channel " +
|
||||
" where channel_type = 0 and coalesce(gb_parent_id, parent_id) = #{parent} " +
|
||||
" <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
|
||||
List<CommonGBChannel> channelList);
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='commonGBChannels' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
", gb_device_id=#{item.gbDeviceId}" +
|
||||
", gb_name=#{item.gbName}" +
|
||||
", gb_manufacturer=#{item.gbManufacturer}" +
|
||||
", gb_model=#{item.gbModel}" +
|
||||
", gb_owner=#{item.gbOwner}" +
|
||||
", gb_civil_code=#{item.gbCivilCode}" +
|
||||
", gb_block=#{item.gbBlock}" +
|
||||
", gb_address=#{item.gbAddress}" +
|
||||
", gb_parental=#{item.gbParental}" +
|
||||
", gb_safety_way=#{item.gbSafetyWay}" +
|
||||
", gb_register_way=#{item.gbRegisterWay}" +
|
||||
", gb_cert_num=#{item.gbCertNum}" +
|
||||
", gb_certifiable=#{item.gbCertifiable}" +
|
||||
", gb_err_code=#{item.gbErrCode}" +
|
||||
", gb_end_time=#{item.gbEndTime}" +
|
||||
", gb_ip_address=#{item.gbIpAddress}" +
|
||||
", gb_port=#{item.gbPort}" +
|
||||
", gb_password=#{item.gbPassword}" +
|
||||
", gb_status=#{item.gbStatus}" +
|
||||
", gb_longitude=#{item.gbLongitude}" +
|
||||
", gb_latitude=#{item.gbLatitude}" +
|
||||
", gb_ptz_type=#{item.gbPtzType}" +
|
||||
", gb_position_type=#{item.gbPositionType}" +
|
||||
", gb_room_type=#{item.gbRoomType}" +
|
||||
", gb_use_type=#{item.gbUseType}" +
|
||||
", gb_supply_light_type=#{item.gbSupplyLightType}" +
|
||||
", gb_direction_type=#{item.gbDirectionType}" +
|
||||
", gb_resolution=#{item.gbResolution}" +
|
||||
", gb_business_group_id=#{item.gbBusinessGroupId}" +
|
||||
", gb_download_speed=#{item.gbDownloadSpeed}" +
|
||||
", gb_svc_space_support_mod=#{item.gbSvcSpaceSupportMod}" +
|
||||
", gb_svc_time_support_mode=#{item.gbSvcTimeSupportMode}" +
|
||||
" WHERE id=#{item.gbId}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdate(List<CommonGBChannel> commonGBChannels);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryWithPlatform")
|
||||
List<CommonGBChannel> queryWithPlatform(@Param("platformId") Integer platformId);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryShareChannelByParentId")
|
||||
List<CommonGBChannel> queryShareChannelByParentId(@Param("parentId") String parentId, @Param("platformId") Integer platformId);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryShareChannelByCivilCode")
|
||||
List<CommonGBChannel> queryShareChannelByCivilCode(@Param("civilCode") String civilCode, @Param("platformId") Integer platformId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_civil_code = #{civilCode}" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
int updateCivilCodeByChannelList(@Param("civilCode") String civilCode, List<CommonGBChannel> channelList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListByStreamPushList")
|
||||
List<CommonGBChannel> queryListByStreamPushList(@Param("dataType") Integer dataType, List<StreamPush> streamPushList);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" <foreach collection='channels' item='item' separator=';' >" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude} " +
|
||||
" WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId} "+
|
||||
"</foreach>"+
|
||||
" </script>"})
|
||||
void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List<CommonGBChannel> channels);
|
||||
void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List<CommonGBChannel> channels);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryList")
|
||||
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
|
||||
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET record_plan_id = null" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>"})
|
||||
void removeRecordPlan(List<Integer> channelIds);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET record_plan_id = #{planId}" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>"})
|
||||
void addRecordPlan(List<Integer> channelIds, @Param("planId") Integer planId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET record_plan_id = #{planId}" +
|
||||
" </script>"})
|
||||
void addRecordPlanForAll(@Param("planId") Integer planId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET record_plan_id = null" +
|
||||
" WHERE record_plan_id = #{planId} "+
|
||||
" </script>"})
|
||||
void removeRecordPlanByPlanId( @Param("planId") Integer planId);
|
||||
void removeRecordPlanByPlanId(@Param("planId") Integer planId);
|
||||
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" wdc.record_plan_id,\n" +
|
||||
" coalesce( wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce( wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce( wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce( wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce( wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce( wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce( wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce( wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce( wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce( wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce( wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce( wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce( wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce( wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce( wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce( wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce( wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce( wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce( wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce( wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce( wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce( wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce( wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce( wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce( wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce( wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce( wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce( wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce( wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce( wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce( 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" +
|
||||
" from wvp_device_channel wdc" +
|
||||
" where wdc.channel_type = 0 " +
|
||||
" <if test='query != null'> " +
|
||||
" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" <if test='online == true'> AND coalesce(wdc.gb_status, wdc.status) = 'ON'</if> " +
|
||||
" <if test='online == false'> AND coalesce(wdc.gb_status, wdc.status) = 'OFF'</if> " +
|
||||
" <if test='hasLink == true'> AND wdc.record_plan_id = #{planId}</if> " +
|
||||
" <if test='hasLink == false'> AND wdc.record_plan_id is null</if> " +
|
||||
" <if test='dataType != null'> AND wdc.data_type = #{dataType}</if> " +
|
||||
"</script>")
|
||||
List<CommonGBChannel> queryForRecordPlanForWebList(@Param("planId") Integer planId, @Param("query") String query,
|
||||
@Param("dataType") Integer dataType, @Param("online") Boolean online,
|
||||
@Param("hasLink") Boolean hasLink);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByDataId")
|
||||
CommonGBChannel queryByDataId(@Param("dataType") Integer dataType, @Param("dataDeviceId") Integer dataDeviceId);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package com.genersoft.iot.vmp.gb28181.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -17,34 +14,10 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface DeviceAlarmMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " +
|
||||
"VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})")
|
||||
int add(DeviceAlarm alarm);
|
||||
|
||||
|
||||
@Select( value = {" <script>" +
|
||||
" SELECT * FROM wvp_device_alarm " +
|
||||
" WHERE 1=1 " +
|
||||
" <if test=\"deviceId != null\" > AND device_id = #{deviceId}</if>" +
|
||||
" <if test=\"alarmPriority != null\" > AND alarm_priority = #{alarmPriority} </if>" +
|
||||
" <if test=\"alarmMethod != null\" > AND alarm_method = #{alarmMethod} </if>" +
|
||||
" <if test=\"alarmType != null\" > AND alarm_type = #{alarmType} </if>" +
|
||||
" <if test=\"startTime != null\" > AND alarm_time >= #{startTime} </if>" +
|
||||
" <if test=\"endTime != null\" > AND alarm_time <= #{endTime} </if>" +
|
||||
" ORDER BY alarm_time ASC " +
|
||||
" </script>"})
|
||||
List<DeviceAlarm> query(@Param("deviceId") String deviceId, @Param("alarmPriority") String alarmPriority, @Param("alarmMethod") String alarmMethod,
|
||||
@Param("alarmType") String alarmType, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
|
||||
@Delete(" <script>" +
|
||||
"DELETE FROM wvp_device_alarm WHERE 1=1 " +
|
||||
" <if test=\"deviceIdList != null and id == null \" > AND device_id in " +
|
||||
"<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
"</if>" +
|
||||
" <if test=\"time != null and id == null \" > AND alarm_time <= #{time}</if>" +
|
||||
" <if test=\"id != null\" > AND id = #{id}</if>" +
|
||||
" </script>"
|
||||
)
|
||||
int clearAlarmBeforeTime(@Param("id") Integer id, @Param("deviceIdList") List<String> deviceIdList, @Param("time") String time);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@ package com.genersoft.iot.vmp.gb28181.dao;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.provider.DeviceChannelProvider;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -18,652 +19,79 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface DeviceChannelMapper {
|
||||
|
||||
|
||||
@Insert("<script> " +
|
||||
"insert into wvp_device_channel " +
|
||||
"(device_id, data_type, data_device_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_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
||||
"values " +
|
||||
"(#{deviceId}, #{dataType}, #{dataDeviceId}, #{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}," +
|
||||
" #{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime}, #{streamIdentification}, #{channelType}) " +
|
||||
"</script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(DeviceChannel channel);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device_channel " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
", device_id=#{deviceId}" +
|
||||
", data_type=#{dataType}" +
|
||||
", data_device_id=#{dataDeviceId}" +
|
||||
", name=#{name}" +
|
||||
", manufacturer=#{manufacturer}" +
|
||||
", model=#{model}" +
|
||||
", owner=#{owner}" +
|
||||
", civil_code=#{civilCode}" +
|
||||
", block=#{block}" +
|
||||
", address=#{address}" +
|
||||
", parental=#{parental}" +
|
||||
", parent_id=#{parentId}" +
|
||||
", safety_way=#{safetyWay}" +
|
||||
", register_way=#{registerWay}" +
|
||||
", cert_num=#{certNum}" +
|
||||
", certifiable=#{certifiable}" +
|
||||
", err_code=#{errCode}" +
|
||||
", end_time=#{endTime}" +
|
||||
", secrecy=#{secrecy}" +
|
||||
", ip_address=#{ipAddress}" +
|
||||
", port=#{port}" +
|
||||
", password=#{password}" +
|
||||
", status=#{status}" +
|
||||
", longitude=#{longitude}" +
|
||||
", latitude=#{latitude}" +
|
||||
", ptz_type=#{ptzType}" +
|
||||
", position_type=#{positionType}" +
|
||||
", room_type=#{roomType}" +
|
||||
", use_type=#{useType}" +
|
||||
", supply_light_type=#{supplyLightType}" +
|
||||
", direction_type=#{directionType}" +
|
||||
", resolution=#{resolution}" +
|
||||
", business_group_id=#{businessGroupId}" +
|
||||
", download_speed=#{downloadSpeed}" +
|
||||
", svc_space_support_mod=#{svcSpaceSupportMod}" +
|
||||
", svc_time_support_mode=#{svcTimeSupportMode}" +
|
||||
", sub_count=#{subCount}" +
|
||||
", stream_id=#{streamId}" +
|
||||
", has_audio=#{hasAudio}" +
|
||||
", gps_time=#{gpsTime}" +
|
||||
", stream_identification=#{streamIdentification}" +
|
||||
", channel_type=#{channelType}" +
|
||||
" WHERE id=#{id}" +
|
||||
" </script>"})
|
||||
int update(DeviceChannel channel);
|
||||
|
||||
@SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels")
|
||||
List<DeviceChannel> queryChannels(@Param("dataDeviceId") int dataDeviceId, @Param("civilCode") String civilCode,
|
||||
@Param("businessGroupId") String businessGroupId, @Param("parentChannelId") String parentChannelId,
|
||||
@Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel,
|
||||
@Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
|
||||
|
||||
@SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId")
|
||||
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("dataDeviceId") int dataDeviceId);
|
||||
|
||||
@Select("<script> " +
|
||||
"select id from wvp_device_channel where data_type =1 and data_device_id in " +
|
||||
" <foreach item='item' index='index' collection='deviceDbIds' open='(' separator=',' close=')'> #{item} </foreach>" +
|
||||
" </script>")
|
||||
List<Integer> queryChaneIdListByDeviceDbIds(List<Integer> deviceDbIds);
|
||||
|
||||
@Delete("DELETE FROM wvp_device_channel WHERE data_type =1 and data_device_id=#{dataDeviceId}")
|
||||
int cleanChannelsByDeviceId(@Param("dataDeviceId") int dataDeviceId);
|
||||
|
||||
@Delete("DELETE FROM wvp_device_channel WHERE id=#{id}")
|
||||
int del(@Param("id") int id);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" SELECT " +
|
||||
" dc.id,\n" +
|
||||
" dc.create_time,\n" +
|
||||
" dc.update_time,\n" +
|
||||
" dc.sub_count,\n" +
|
||||
" coalesce(dc.gb_device_id, dc.device_id) as channel_id,\n" +
|
||||
" de.device_id as device_id,\n" +
|
||||
" coalesce(dc.gb_name, dc.name) as name,\n" +
|
||||
" de.name as device_name,\n" +
|
||||
" de.on_line as device_online,\n" +
|
||||
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacture,\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_ptz_type, dc.ptz_type) as ptz_type,\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_business_group_id, dc.business_group_id) as business_group_id " +
|
||||
" from " +
|
||||
" wvp_device_channel dc " +
|
||||
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
|
||||
" WHERE dc.data_type = 1 " +
|
||||
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </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='ON'</if>" +
|
||||
" <if test='online == false' > AND dc.status='OFF'</if>" +
|
||||
" <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
|
||||
" <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
|
||||
"<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.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);
|
||||
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);
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"})
|
||||
void startPlay(@Param("channelId") Integer channelId, @Param("streamId") String streamId);
|
||||
|
||||
|
||||
@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 " +
|
||||
" FROM wvp_device_channel dc " +
|
||||
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
|
||||
" LEFT JOIN wvp_platform_channel pgc on pgc.device_channel_id = dc.id " +
|
||||
" WHERE dc.data_type = 1 " +
|
||||
" <if test='query != null'> " +
|
||||
"AND " +
|
||||
"(COALESCE(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " +
|
||||
" OR COALESCE(dc.gb_name, dc.name) LIKE concat('%',#{query},'%'))</if> " +
|
||||
" <if test='online == true' > AND dc.status='ON'</if> " +
|
||||
" <if test='online == false' > AND dc.status='OFF'</if> " +
|
||||
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.sub_count > 0</if> " +
|
||||
" <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.sub_count = 0</if> " +
|
||||
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_channel where platform_id=#{platformId} ) </if> " +
|
||||
" <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
|
||||
" ORDER BY COALESCE(dc.gb_device_id, dc.device_id) ASC" +
|
||||
" </script>"})
|
||||
List<ChannelReduce> queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
||||
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{id}"})
|
||||
void offline(@Param("id") int id);
|
||||
|
||||
@Insert("<script> " +
|
||||
"insert into wvp_device_channel " +
|
||||
"(device_id, data_type, data_device_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_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
||||
"values " +
|
||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
||||
"(#{item.deviceId}, #{item.dataType}, #{item.dataDeviceId}, #{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}," +
|
||||
" #{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId}, #{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}, #{item.channelType}) " +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
|
||||
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET status='ON' WHERE id=#{id}"})
|
||||
void online(@Param("id") int id);
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='updateChannels' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
", device_id=#{item.deviceId}" +
|
||||
", data_type=#{item.dataType}" +
|
||||
", data_device_id=#{item.dataDeviceId}" +
|
||||
", name=#{item.name}" +
|
||||
", manufacturer=#{item.manufacturer}" +
|
||||
", model=#{item.model}" +
|
||||
", owner=#{item.owner}" +
|
||||
", civil_code=#{item.civilCode}" +
|
||||
", block=#{item.block}" +
|
||||
", address=#{item.address}" +
|
||||
", parental=#{item.parental}" +
|
||||
", parent_id=#{item.parentId}" +
|
||||
", safety_way=#{item.safetyWay}" +
|
||||
", register_way=#{item.registerWay}" +
|
||||
", cert_num=#{item.certNum}" +
|
||||
", certifiable=#{item.certifiable}" +
|
||||
", err_code=#{item.errCode}" +
|
||||
", end_time=#{item.endTime}" +
|
||||
", secrecy=#{item.secrecy}" +
|
||||
", ip_address=#{item.ipAddress}" +
|
||||
", port=#{item.port}" +
|
||||
", password=#{item.password}" +
|
||||
", status=#{item.status}" +
|
||||
", longitude=#{item.longitude}" +
|
||||
", latitude=#{item.latitude}" +
|
||||
", ptz_type=#{item.ptzType}" +
|
||||
", position_type=#{item.positionType}" +
|
||||
", room_type=#{item.roomType}" +
|
||||
", use_type=#{item.useType}" +
|
||||
", supply_light_type=#{item.supplyLightType}" +
|
||||
", direction_type=#{item.directionType}" +
|
||||
", resolution=#{item.resolution}" +
|
||||
", business_group_id=#{item.businessGroupId}" +
|
||||
", download_speed=#{item.downloadSpeed}" +
|
||||
", svc_space_support_mod=#{item.svcSpaceSupportMod}" +
|
||||
", svc_time_support_mode=#{item.svcTimeSupportMode}" +
|
||||
", sub_count=#{item.subCount}" +
|
||||
", stream_id=#{item.streamId}" +
|
||||
", has_audio=#{item.hasAudio}" +
|
||||
", gps_time=#{item.gpsTime}" +
|
||||
", stream_identification=#{item.streamIdentification}" +
|
||||
", channel_type=#{item.channelType}" +
|
||||
" WHERE id=#{item.id}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdate(List<DeviceChannel> updateChannels);
|
||||
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='updateChannels' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
", device_id=#{item.deviceId}" +
|
||||
", data_type=#{item.dataType}" +
|
||||
", data_device_id=#{item.dataDeviceId}" +
|
||||
", name=#{item.name}" +
|
||||
", manufacturer=#{item.manufacturer}" +
|
||||
", model=#{item.model}" +
|
||||
", owner=#{item.owner}" +
|
||||
", civil_code=#{item.civilCode}" +
|
||||
", block=#{item.block}" +
|
||||
", address=#{item.address}" +
|
||||
", parental=#{item.parental}" +
|
||||
", parent_id=#{item.parentId}" +
|
||||
", safety_way=#{item.safetyWay}" +
|
||||
", register_way=#{item.registerWay}" +
|
||||
", cert_num=#{item.certNum}" +
|
||||
", certifiable=#{item.certifiable}" +
|
||||
", err_code=#{item.errCode}" +
|
||||
", end_time=#{item.endTime}" +
|
||||
", secrecy=#{item.secrecy}" +
|
||||
", ip_address=#{item.ipAddress}" +
|
||||
", port=#{item.port}" +
|
||||
", password=#{item.password}" +
|
||||
", status=#{item.status}" +
|
||||
", longitude=#{item.longitude}" +
|
||||
", latitude=#{item.latitude}" +
|
||||
", ptz_type=#{item.ptzType}" +
|
||||
", position_type=#{item.positionType}" +
|
||||
", room_type=#{item.roomType}" +
|
||||
", use_type=#{item.useType}" +
|
||||
", supply_light_type=#{item.supplyLightType}" +
|
||||
", direction_type=#{item.directionType}" +
|
||||
", resolution=#{item.resolution}" +
|
||||
", business_group_id=#{item.businessGroupId}" +
|
||||
", download_speed=#{item.downloadSpeed}" +
|
||||
", svc_space_support_mod=#{item.svcSpaceSupportMod}" +
|
||||
", svc_time_support_mode=#{item.svcTimeSupportMode}" +
|
||||
", sub_count=#{item.subCount}" +
|
||||
", stream_id=#{item.streamId}" +
|
||||
", has_audio=#{item.hasAudio}" +
|
||||
", gps_time=#{item.gpsTime}" +
|
||||
", stream_identification=#{item.streamIdentification}" +
|
||||
", channel_type=#{item.channelType}" +
|
||||
" WHERE data_type = #{item.dataType} and data_device_id = #{item.dataDeviceId} and device_id=#{item.deviceId}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdateForNotify(List<DeviceChannel> updateChannels);
|
||||
|
||||
@Update(" update wvp_device_channel" +
|
||||
" set sub_count = (select *" +
|
||||
" from (select count(0)" +
|
||||
" from wvp_device_channel" +
|
||||
" where data_type = 1 and data_device_id = #{dataDeviceId} and parent_id = #{channelId}) as temp)" +
|
||||
" where data_type = 1 and data_device_id = #{dataDeviceId} and device_id = #{channelId}")
|
||||
int updateChannelSubCount(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET " +
|
||||
" latitude=#{latitude}, " +
|
||||
" longitude=#{longitude}, " +
|
||||
" gps_time=#{gpsTime} " +
|
||||
" WHERE id=#{id} " +
|
||||
" </script>"})
|
||||
int updatePosition(DeviceChannel deviceChannel);
|
||||
|
||||
@Select("select " +
|
||||
" id,\n" +
|
||||
" data_device_id,\n" +
|
||||
" create_time,\n" +
|
||||
" update_time,\n" +
|
||||
" sub_count,\n" +
|
||||
" stream_id,\n" +
|
||||
" has_audio,\n" +
|
||||
" gps_time,\n" +
|
||||
" stream_identification,\n" +
|
||||
" channel_type,\n" +
|
||||
" device_id,\n" +
|
||||
" name,\n" +
|
||||
" manufacturer,\n" +
|
||||
" model,\n" +
|
||||
" owner,\n" +
|
||||
" civil_code,\n" +
|
||||
" block,\n" +
|
||||
" address,\n" +
|
||||
" parental,\n" +
|
||||
" parent_id,\n" +
|
||||
" safety_way,\n" +
|
||||
" register_way,\n" +
|
||||
" cert_num,\n" +
|
||||
" certifiable,\n" +
|
||||
" err_code,\n" +
|
||||
" end_time,\n" +
|
||||
" secrecy,\n" +
|
||||
" ip_address,\n" +
|
||||
" port,\n" +
|
||||
" password,\n" +
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
" use_type,\n" +
|
||||
" supply_light_type,\n" +
|
||||
" direction_type,\n" +
|
||||
" resolution,\n" +
|
||||
" business_group_id,\n" +
|
||||
" download_speed,\n" +
|
||||
" svc_space_support_mod,\n" +
|
||||
" svc_time_support_mode\n" +
|
||||
" from wvp_device_channel where data_type = 1 and data_device_id = #{dataDeviceId}")
|
||||
List<DeviceChannel> queryAllChannelsForRefresh(@Param("dataDeviceId") int dataDeviceId);
|
||||
|
||||
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.device_id where dc.data_type = 1 and dc.device_id=#{channelId}")
|
||||
List<Device> getDeviceByChannelDeviceId(@Param("channelId") String channelId);
|
||||
|
||||
|
||||
@Delete({"<script>" +
|
||||
"<foreach collection='deleteChannelList' item='item' separator=';'>" +
|
||||
"DELETE FROM wvp_device_channel WHERE id=#{item.id}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchDel(List<DeviceChannel> deleteChannelList);
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='channels' item='item' separator=';'>" +
|
||||
"UPDATE wvp_device_channel SET status=#{item.status} WHERE data_type = #{item.dataType} and device_id=#{item.deviceId}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdateStatus(List<DeviceChannel> channels);
|
||||
|
||||
@Select("select count(1) from wvp_device_channel where status = 'ON'")
|
||||
int getOnlineCount();
|
||||
|
||||
@Select("select count(1) from wvp_device_channel")
|
||||
int getAllChannelCount();
|
||||
|
||||
@Update("<script>" +
|
||||
"UPDATE wvp_device_channel SET stream_identification=#{streamIdentification} WHERE id=#{id}" +
|
||||
"</script>")
|
||||
void updateChannelStreamIdentification(DeviceChannel channel);
|
||||
|
||||
@Update("<script>" +
|
||||
"UPDATE wvp_device_channel SET stream_identification=#{streamIdentification}" +
|
||||
"</script>")
|
||||
void updateAllChannelStreamIdentification(@Param("streamIdentification") String streamIdentification);
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='channelList' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
|
||||
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
|
||||
"<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
|
||||
"<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
|
||||
"<if test='item.id == 0'>WHERE data_type = #{item.dataType} and data_device_id=#{item.dataDeviceId} AND device_id=#{item.deviceId}</if>" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
void batchUpdatePosition(List<DeviceChannel> channelList);
|
||||
|
||||
@SelectProvider(type = DeviceChannelProvider.class, method = "getOne")
|
||||
DeviceChannel getOne(@Param("id") int id);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" SELECT " +
|
||||
" id,\n" +
|
||||
" data_device_id,\n" +
|
||||
" create_time,\n" +
|
||||
" update_time,\n" +
|
||||
" sub_count,\n" +
|
||||
" stream_id,\n" +
|
||||
" has_audio,\n" +
|
||||
" gps_time,\n" +
|
||||
" stream_identification,\n" +
|
||||
" channel_type,\n" +
|
||||
" device_id,\n" +
|
||||
" name,\n" +
|
||||
" manufacturer,\n" +
|
||||
" model,\n" +
|
||||
" owner,\n" +
|
||||
" civil_code,\n" +
|
||||
" block,\n" +
|
||||
" address,\n" +
|
||||
" parental,\n" +
|
||||
" parent_id,\n" +
|
||||
" safety_way,\n" +
|
||||
" register_way,\n" +
|
||||
" cert_num,\n" +
|
||||
" certifiable,\n" +
|
||||
" err_code,\n" +
|
||||
" end_time,\n" +
|
||||
" secrecy,\n" +
|
||||
" ip_address,\n" +
|
||||
" port,\n" +
|
||||
" password,\n" +
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
" use_type,\n" +
|
||||
" supply_light_type,\n" +
|
||||
" direction_type,\n" +
|
||||
" resolution,\n" +
|
||||
" business_group_id,\n" +
|
||||
" download_speed,\n" +
|
||||
" svc_space_support_mod,\n" +
|
||||
" svc_time_support_mode\n" +
|
||||
" from wvp_device_channel " +
|
||||
" where id=#{id}" +
|
||||
" </script>"})
|
||||
DeviceChannel getOneForSource(@Param("id") int id);
|
||||
|
||||
@SelectProvider(type = DeviceChannelProvider.class, method = "getOneByDeviceId")
|
||||
DeviceChannel getOneByDeviceId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
|
||||
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" SELECT " +
|
||||
" id,\n" +
|
||||
" data_device_id,\n" +
|
||||
" create_time,\n" +
|
||||
" update_time,\n" +
|
||||
" sub_count,\n" +
|
||||
" stream_id,\n" +
|
||||
" has_audio,\n" +
|
||||
" gps_time,\n" +
|
||||
" stream_identification,\n" +
|
||||
" channel_type,\n" +
|
||||
" device_id,\n" +
|
||||
" name,\n" +
|
||||
" manufacturer,\n" +
|
||||
" model,\n" +
|
||||
" owner,\n" +
|
||||
" civil_code,\n" +
|
||||
" block,\n" +
|
||||
" address,\n" +
|
||||
" parental,\n" +
|
||||
" parent_id,\n" +
|
||||
" safety_way,\n" +
|
||||
" register_way,\n" +
|
||||
" cert_num,\n" +
|
||||
" certifiable,\n" +
|
||||
" err_code,\n" +
|
||||
" end_time,\n" +
|
||||
" secrecy,\n" +
|
||||
" ip_address,\n" +
|
||||
" port,\n" +
|
||||
" password,\n" +
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
" use_type,\n" +
|
||||
" supply_light_type,\n" +
|
||||
" direction_type,\n" +
|
||||
" resolution,\n" +
|
||||
" business_group_id,\n" +
|
||||
" download_speed,\n" +
|
||||
" svc_space_support_mod,\n" +
|
||||
" svc_time_support_mode\n" +
|
||||
" from wvp_device_channel " +
|
||||
" where data_type = 1 and data_device_id=#{dataDeviceId} and coalesce(gb_device_id, device_id) = #{channelId}" +
|
||||
" </script>"})
|
||||
DeviceChannel getOneByDeviceIdForSource(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
|
||||
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE id=#{channelId}"})
|
||||
void stopPlayById(@Param("channelId") Integer channelId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device_channel " +
|
||||
"SET has_audio=#{audio}" +
|
||||
" WHERE id=#{channelId}" +
|
||||
" </script>"})
|
||||
void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='gpsMsgInfoList' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET gb_longitude = #{item.lng}, gb_latitude=#{item.lat} WHERE id = #{item.channelId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList);
|
||||
|
||||
@Update("UPDATE wvp_device_channel SET status=#{status} WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}")
|
||||
void updateStatus(DeviceChannel channel);
|
||||
|
||||
|
||||
@Update({"<script>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{updateTime}" +
|
||||
", device_id=#{deviceId}" +
|
||||
", data_device_id=#{dataDeviceId}" +
|
||||
", name=#{name}" +
|
||||
", manufacturer=#{manufacturer}" +
|
||||
", model=#{model}" +
|
||||
", owner=#{owner}" +
|
||||
", civil_code=#{civilCode}" +
|
||||
", block=#{block}" +
|
||||
", address=#{address}" +
|
||||
", parental=#{parental}" +
|
||||
", parent_id=#{parentId}" +
|
||||
", safety_way=#{safetyWay}" +
|
||||
", register_way=#{registerWay}" +
|
||||
", cert_num=#{certNum}" +
|
||||
", certifiable=#{certifiable}" +
|
||||
", err_code=#{errCode}" +
|
||||
", end_time=#{endTime}" +
|
||||
", secrecy=#{secrecy}" +
|
||||
", ip_address=#{ipAddress}" +
|
||||
", port=#{port}" +
|
||||
", password=#{password}" +
|
||||
", status=#{status}" +
|
||||
", longitude=#{longitude}" +
|
||||
", latitude=#{latitude}" +
|
||||
", ptz_type=#{ptzType}" +
|
||||
", position_type=#{positionType}" +
|
||||
", room_type=#{roomType}" +
|
||||
", use_type=#{useType}" +
|
||||
", supply_light_type=#{supplyLightType}" +
|
||||
", direction_type=#{directionType}" +
|
||||
", resolution=#{resolution}" +
|
||||
", business_group_id=#{businessGroupId}" +
|
||||
", download_speed=#{downloadSpeed}" +
|
||||
", svc_space_support_mod=#{svcSpaceSupportMod}" +
|
||||
", svc_time_support_mode=#{svcTimeSupportMode}" +
|
||||
", sub_count=#{subCount}" +
|
||||
", stream_id=#{streamId}" +
|
||||
", has_audio=#{hasAudio}" +
|
||||
", gps_time=#{gpsTime}" +
|
||||
", stream_identification=#{streamIdentification}" +
|
||||
", channel_type=#{channelType}" +
|
||||
" WHERE id = #{id}" +
|
||||
"</script>"})
|
||||
void updateChannelForNotify(DeviceChannel channel);
|
||||
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" SELECT " +
|
||||
" id,\n" +
|
||||
" data_device_id,\n" +
|
||||
" create_time,\n" +
|
||||
" update_time,\n" +
|
||||
" sub_count,\n" +
|
||||
" stream_id,\n" +
|
||||
" has_audio,\n" +
|
||||
" gps_time,\n" +
|
||||
" stream_identification,\n" +
|
||||
" channel_type,\n" +
|
||||
" device_id,\n" +
|
||||
" name,\n" +
|
||||
" manufacturer,\n" +
|
||||
" model,\n" +
|
||||
" owner,\n" +
|
||||
" civil_code,\n" +
|
||||
" block,\n" +
|
||||
" address,\n" +
|
||||
" parental,\n" +
|
||||
" parent_id,\n" +
|
||||
" safety_way,\n" +
|
||||
" register_way,\n" +
|
||||
" cert_num,\n" +
|
||||
" certifiable,\n" +
|
||||
" err_code,\n" +
|
||||
" end_time,\n" +
|
||||
" secrecy,\n" +
|
||||
" ip_address,\n" +
|
||||
" port,\n" +
|
||||
" password,\n" +
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
" use_type,\n" +
|
||||
" supply_light_type,\n" +
|
||||
" direction_type,\n" +
|
||||
" resolution,\n" +
|
||||
" business_group_id,\n" +
|
||||
" download_speed,\n" +
|
||||
" svc_space_support_mod,\n" +
|
||||
" svc_time_support_mode\n" +
|
||||
" from wvp_device_channel " +
|
||||
" where data_type = 1 and data_device_id=#{dataDeviceId} and device_id = #{channelId}" +
|
||||
" </script>"})
|
||||
DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.genersoft.iot.vmp.gb28181.dao;
|
|||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,353 +16,40 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface DeviceMapper {
|
||||
|
||||
@Select("SELECT " +
|
||||
"id, " +
|
||||
"device_id, " +
|
||||
"coalesce(custom_name, name) as name, " +
|
||||
"password, " +
|
||||
"manufacturer, " +
|
||||
"model, " +
|
||||
"firmware, " +
|
||||
"transport," +
|
||||
"stream_mode," +
|
||||
"ip," +
|
||||
"sdp_ip," +
|
||||
"local_ip," +
|
||||
"port," +
|
||||
"host_address," +
|
||||
"expires," +
|
||||
"register_time," +
|
||||
"keepalive_time," +
|
||||
"create_time," +
|
||||
"update_time," +
|
||||
"charset," +
|
||||
"subscribe_cycle_for_catalog," +
|
||||
"subscribe_cycle_for_mobile_position," +
|
||||
"mobile_position_submission_interval," +
|
||||
"subscribe_cycle_for_alarm," +
|
||||
"ssrc_check," +
|
||||
"as_message_channel," +
|
||||
"geo_coord_sys," +
|
||||
"on_line," +
|
||||
"media_server_id," +
|
||||
"broadcast_push_after_ack," +
|
||||
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = 1 and dc.data_device_id= de.id) as channel_count "+
|
||||
" FROM wvp_device de WHERE de.device_id = #{deviceId}")
|
||||
Device getDeviceByDeviceId( @Param("deviceId") String deviceId);
|
||||
Device getDeviceByDeviceId(@Param("deviceId") String deviceId);
|
||||
|
||||
@Insert("INSERT INTO wvp_device (" +
|
||||
"device_id, " +
|
||||
"name, " +
|
||||
"manufacturer, " +
|
||||
"model, " +
|
||||
"firmware, " +
|
||||
"transport," +
|
||||
"stream_mode," +
|
||||
"media_server_id," +
|
||||
"ip," +
|
||||
"sdp_ip," +
|
||||
"local_ip," +
|
||||
"port," +
|
||||
"host_address," +
|
||||
"expires," +
|
||||
"register_time," +
|
||||
"keepalive_time," +
|
||||
"keepalive_interval_time," +
|
||||
"create_time," +
|
||||
"update_time," +
|
||||
"charset," +
|
||||
"subscribe_cycle_for_catalog," +
|
||||
"subscribe_cycle_for_mobile_position,"+
|
||||
"mobile_position_submission_interval,"+
|
||||
"subscribe_cycle_for_alarm,"+
|
||||
"ssrc_check,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
"on_line"+
|
||||
") VALUES (" +
|
||||
"#{deviceId}," +
|
||||
"#{name}," +
|
||||
"#{manufacturer}," +
|
||||
"#{model}," +
|
||||
"#{firmware}," +
|
||||
"#{transport}," +
|
||||
"#{streamMode}," +
|
||||
"#{mediaServerId}," +
|
||||
"#{ip}," +
|
||||
"#{sdpIp}," +
|
||||
"#{localIp}," +
|
||||
"#{port}," +
|
||||
"#{hostAddress}," +
|
||||
"#{expires}," +
|
||||
"#{registerTime}," +
|
||||
"#{keepaliveTime}," +
|
||||
"#{keepaliveIntervalTime}," +
|
||||
"#{createTime}," +
|
||||
"#{updateTime}," +
|
||||
"#{charset}," +
|
||||
"#{subscribeCycleForCatalog}," +
|
||||
"#{subscribeCycleForMobilePosition}," +
|
||||
"#{mobilePositionSubmissionInterval}," +
|
||||
"#{subscribeCycleForAlarm}," +
|
||||
"#{ssrcCheck}," +
|
||||
"#{asMessageChannel}," +
|
||||
"#{broadcastPushAfterAck}," +
|
||||
"#{geoCoordSys}," +
|
||||
"#{onLine}" +
|
||||
")")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(Device device);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
"<if test=\"name != null\">, name=#{name}</if>" +
|
||||
"<if test=\"manufacturer != null\">, manufacturer=#{manufacturer}</if>" +
|
||||
"<if test=\"model != null\">, model=#{model}</if>" +
|
||||
"<if test=\"firmware != null\">, firmware=#{firmware}</if>" +
|
||||
"<if test=\"transport != null\">, transport=#{transport}</if>" +
|
||||
"<if test=\"ip != null\">, ip=#{ip}</if>" +
|
||||
"<if test=\"localIp != null\">, local_ip=#{localIp}</if>" +
|
||||
"<if test=\"port != null\">, port=#{port}</if>" +
|
||||
"<if test=\"hostAddress != null\">, host_address=#{hostAddress}</if>" +
|
||||
"<if test=\"onLine != null\">, on_line=#{onLine}</if>" +
|
||||
"<if test=\"registerTime != null\">, register_time=#{registerTime}</if>" +
|
||||
"<if test=\"keepaliveTime != null\">, keepalive_time=#{keepaliveTime}</if>" +
|
||||
"<if test=\"keepaliveIntervalTime != null\">, keepalive_interval_time=#{keepaliveIntervalTime}</if>" +
|
||||
"<if test=\"expires != null\">, expires=#{expires}</if>" +
|
||||
"WHERE device_id=#{deviceId}"+
|
||||
" </script>"})
|
||||
int update(Device device);
|
||||
|
||||
@Select(
|
||||
" <script>" +
|
||||
"SELECT " +
|
||||
"id, " +
|
||||
"device_id, " +
|
||||
"coalesce(custom_name, name) as name, " +
|
||||
"password, " +
|
||||
"manufacturer, " +
|
||||
"model, " +
|
||||
"firmware, " +
|
||||
"transport," +
|
||||
"stream_mode," +
|
||||
"ip,"+
|
||||
"sdp_ip,"+
|
||||
"local_ip,"+
|
||||
"port,"+
|
||||
"host_address,"+
|
||||
"expires,"+
|
||||
"register_time,"+
|
||||
"keepalive_time,"+
|
||||
"create_time,"+
|
||||
"update_time,"+
|
||||
"charset,"+
|
||||
"subscribe_cycle_for_catalog,"+
|
||||
"subscribe_cycle_for_mobile_position,"+
|
||||
"mobile_position_submission_interval,"+
|
||||
"subscribe_cycle_for_alarm,"+
|
||||
"ssrc_check,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
"on_line,"+
|
||||
"media_server_id,"+
|
||||
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
|
||||
"FROM wvp_device de" +
|
||||
"<if test='online != null'> where de.on_line=${online}</if>"+
|
||||
" order by de.create_time desc "+
|
||||
" </script>"
|
||||
)
|
||||
List<Device> getDevices(@Param("dataType") Integer dataType, @Param("online") Boolean online);
|
||||
|
||||
@Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}")
|
||||
int del(String deviceId);
|
||||
|
||||
@Select("SELECT " +
|
||||
"id, " +
|
||||
"device_id, " +
|
||||
"coalesce(custom_name, name) as name, " +
|
||||
"password, " +
|
||||
"manufacturer, " +
|
||||
"model, " +
|
||||
"firmware, " +
|
||||
"transport," +
|
||||
"stream_mode," +
|
||||
"ip," +
|
||||
"sdp_ip,"+
|
||||
"local_ip,"+
|
||||
"port,"+
|
||||
"host_address,"+
|
||||
"expires,"+
|
||||
"register_time,"+
|
||||
"keepalive_time,"+
|
||||
"create_time,"+
|
||||
"update_time,"+
|
||||
"charset,"+
|
||||
"subscribe_cycle_for_catalog,"+
|
||||
"subscribe_cycle_for_mobile_position,"+
|
||||
"mobile_position_submission_interval,"+
|
||||
"subscribe_cycle_for_alarm,"+
|
||||
"ssrc_check,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
"on_line"+
|
||||
" FROM wvp_device WHERE on_line = true")
|
||||
List<Device> getOnlineDevices();
|
||||
|
||||
@Select("SELECT " +
|
||||
"id,"+
|
||||
"device_id,"+
|
||||
"coalesce(custom_name,name)as name,"+
|
||||
"password,"+
|
||||
"manufacturer,"+
|
||||
"model,"+
|
||||
"firmware,"+
|
||||
"transport,"+
|
||||
"stream_mode,"+
|
||||
"ip,"+
|
||||
"sdp_ip,"+
|
||||
"local_ip,"+
|
||||
"port,"+
|
||||
"host_address,"+
|
||||
"expires,"+
|
||||
"register_time,"+
|
||||
"keepalive_time,"+
|
||||
"create_time,"+
|
||||
"update_time,"+
|
||||
"charset,"+
|
||||
"subscribe_cycle_for_catalog,"+
|
||||
"subscribe_cycle_for_mobile_position,"+
|
||||
"mobile_position_submission_interval,"+
|
||||
"subscribe_cycle_for_alarm,"+
|
||||
"ssrc_check,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
"on_line"+
|
||||
" FROM wvp_device WHERE ip = #{host} AND port=#{port}")
|
||||
Device getDeviceByHostAndPort(@Param("host") String host, @Param("port") int port);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device " +
|
||||
"SET update_time=#{updateTime}, custom_name=#{name} , password=#{password}, stream_mode=#{streamMode}" +
|
||||
", ip=#{ip}, sdp_ip=#{sdpIp}, port=#{port}, charset=#{charset}" +
|
||||
", ssrc_check=#{ssrcCheck}, as_message_channel=#{asMessageChannel}" +
|
||||
", broadcast_push_after_ack=#{broadcastPushAfterAck}, geo_coord_sys=#{geoCoordSys}, media_server_id=#{mediaServerId}" +
|
||||
" WHERE id=#{id}"+
|
||||
" </script>"})
|
||||
void updateCustom(Device device);
|
||||
|
||||
@Insert("INSERT INTO wvp_device (" +
|
||||
"device_id,"+
|
||||
"custom_name,"+
|
||||
"password,"+
|
||||
"sdp_ip,"+
|
||||
"create_time,"+
|
||||
"update_time,"+
|
||||
"charset,"+
|
||||
"ssrc_check,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
"on_line,"+
|
||||
"stream_mode," +
|
||||
"media_server_id"+
|
||||
") VALUES (" +
|
||||
"#{deviceId}," +
|
||||
"#{name}," +
|
||||
"#{password}," +
|
||||
"#{sdpIp}," +
|
||||
"#{createTime}," +
|
||||
"#{updateTime}," +
|
||||
"#{charset}," +
|
||||
"#{ssrcCheck}," +
|
||||
"#{asMessageChannel}," +
|
||||
"#{broadcastPushAfterAck}," +
|
||||
"#{geoCoordSys}," +
|
||||
"#{onLine}," +
|
||||
"#{streamMode}," +
|
||||
"#{mediaServerId}" +
|
||||
")")
|
||||
void addCustomDevice(Device device);
|
||||
|
||||
@Select("select * FROM wvp_device")
|
||||
List<Device> getAll();
|
||||
|
||||
@Select("select * FROM wvp_device where as_message_channel = true")
|
||||
List<Device> queryDeviceWithAsMessageChannel();
|
||||
|
||||
@Select(" <script>" +
|
||||
"SELECT " +
|
||||
"id, " +
|
||||
"device_id, " +
|
||||
"coalesce(custom_name, name) as name, " +
|
||||
"password, " +
|
||||
"manufacturer, " +
|
||||
"model, " +
|
||||
"firmware, " +
|
||||
"transport," +
|
||||
"stream_mode," +
|
||||
"ip,"+
|
||||
"sdp_ip,"+
|
||||
"local_ip,"+
|
||||
"port,"+
|
||||
"host_address,"+
|
||||
"expires,"+
|
||||
"register_time,"+
|
||||
"keepalive_time,"+
|
||||
"create_time,"+
|
||||
"update_time,"+
|
||||
"charset,"+
|
||||
"subscribe_cycle_for_catalog,"+
|
||||
"subscribe_cycle_for_mobile_position,"+
|
||||
"mobile_position_submission_interval,"+
|
||||
"subscribe_cycle_for_alarm,"+
|
||||
"ssrc_check,"+
|
||||
"as_message_channel,"+
|
||||
"broadcast_push_after_ack,"+
|
||||
"geo_coord_sys,"+
|
||||
"on_line,"+
|
||||
"media_server_id,"+
|
||||
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
|
||||
" FROM wvp_device de" +
|
||||
" where 1 = 1 "+
|
||||
" <if test='status != null'> AND de.on_line=${status}</if>"+
|
||||
" <if test='query != null'> AND (" +
|
||||
" coalesce(custom_name, name) LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR device_id LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR ip LIKE concat('%',#{query},'%') escape '/')" +
|
||||
"</if> " +
|
||||
" order by create_time desc "+
|
||||
" </script>")
|
||||
List<Device> getDeviceList(@Param("dataType") Integer dataType, @Param("query") String query, @Param("status") Boolean status);
|
||||
|
||||
@Select("select * from wvp_device_channel where id = #{id}")
|
||||
DeviceChannel getRawChannel(@Param("id") int id);
|
||||
|
||||
@Select("select * from wvp_device where id = #{id}")
|
||||
Device query(@Param("id") Integer id);
|
||||
|
||||
@Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.id = #{channelId}")
|
||||
Device queryByChannelId(@Param("dataType") Integer dataType, @Param("channelId") Integer channelId);
|
||||
|
||||
@Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.device_id = #{channelDeviceId}")
|
||||
Device getDeviceBySourceChannelDeviceId(@Param("dataType") Integer dataType, @Param("channelDeviceId") String channelDeviceId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device " +
|
||||
" SET subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}" +
|
||||
" WHERE id=#{id}"+
|
||||
" </script>"})
|
||||
void updateSubscribeCatalog(Device device);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device " +
|
||||
"SET subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition}, mobile_position_submission_interval=#{mobilePositionSubmissionInterval}" +
|
||||
" WHERE id=#{id}"+
|
||||
" </script>"})
|
||||
void updateSubscribeMobilePosition(Device device);
|
||||
}
|
||||
|
|
|
@ -1,49 +1,22 @@
|
|||
package com.genersoft.iot.vmp.gb28181.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeviceMobilePositionMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,create_time)"+
|
||||
"VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{createTime})")
|
||||
int insertNewPosition(MobilePosition mobilePosition);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * FROM wvp_device_mobile_position" +
|
||||
" WHERE device_id = #{deviceId}" +
|
||||
"<if test=\"channelId != null\"> and channel_id = #{channelId}</if>" +
|
||||
"<if test=\"startTime != null\"> AND time>=#{startTime}</if>" +
|
||||
"<if test=\"endTime != null\"> AND time<=#{endTime}</if>" +
|
||||
" ORDER BY time ASC" +
|
||||
" </script>"})
|
||||
List<MobilePosition> queryPositionByDeviceIdAndTime(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
@Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" +
|
||||
" ORDER BY time DESC LIMIT 1")
|
||||
MobilePosition queryLatestPositionByDevice(String deviceId);
|
||||
|
||||
@Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
|
||||
int clearMobilePositionsByDeviceId(String deviceId);
|
||||
|
||||
@Insert("<script> " +
|
||||
"<foreach collection='mobilePositions' index='index' item='item' separator=';'> " +
|
||||
"insert into wvp_device_mobile_position " +
|
||||
"(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," +
|
||||
"create_time)"+
|
||||
"values " +
|
||||
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
|
||||
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
|
||||
"#{item.reportSource}, #{item.createTime}) " +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void batchadd(List<MobilePosition> mobilePositions);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -12,258 +14,63 @@ import java.util.Set;
|
|||
@Mapper
|
||||
public interface GroupMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(Group group);
|
||||
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time, civil_code) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int addBusinessGroup(Group group);
|
||||
|
||||
@Delete("DELETE FROM wvp_common_group WHERE id=#{id}")
|
||||
int delete(@Param("id") int id);
|
||||
|
||||
@Update(" UPDATE wvp_common_group " +
|
||||
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, " +
|
||||
" parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}, civil_code=#{civilCode}" +
|
||||
" WHERE id = #{id}")
|
||||
int update(Group group);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * from wvp_common_group WHERE 1=1 " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" <if test='parentId != null and businessGroupId != null '> AND parent_device_id = #{parentId} AND business_group=#{businessGroup} </if> " +
|
||||
"ORDER BY id " +
|
||||
" </script>"})
|
||||
List<Group> query(@Param("query") String query, @Param("parentId") String parentId, @Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE parent_id = #{parentId} ")
|
||||
List<Group> getChildren(@Param("parentId") int parentId);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE id = #{id} ")
|
||||
Group queryOne(@Param("id") int id);
|
||||
|
||||
|
||||
@Insert(" <script>" +
|
||||
" INSERT INTO wvp_common_group (" +
|
||||
" device_id," +
|
||||
" name, " +
|
||||
" parent_device_id," +
|
||||
" parent_id," +
|
||||
" business_group," +
|
||||
" create_time," +
|
||||
" civil_code," +
|
||||
" update_time) " +
|
||||
" VALUES " +
|
||||
" <foreach collection='groupList' index='index' item='item' separator=','> " +
|
||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup},#{item.createTime},#{item.civilCode},#{item.updateTime})" +
|
||||
" </foreach> " +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int batchAdd(List<Group> groupList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * , " +
|
||||
" concat('group', id) as tree_id," +
|
||||
" 0 as type," +
|
||||
" false as is_leaf," +
|
||||
" 'ON' as status" +
|
||||
" from wvp_common_group " +
|
||||
" where 1=1 " +
|
||||
" <if test='parentId != null'> and parent_id = #{parentId} </if> " +
|
||||
" <if test='parentId == null'> and parent_id is null </if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * , " +
|
||||
" 0 as type," +
|
||||
" false as is_leaf" +
|
||||
" from wvp_common_group " +
|
||||
" where parent_id is not null and business_group = #{businessGroup} and device_id != #{businessGroup}" +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryForTreeByBusinessGroup(@Param("query") String query,
|
||||
@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" *," +
|
||||
" 0 as type," +
|
||||
" false as is_leaf" +
|
||||
" from wvp_common_group " +
|
||||
" where device_id=business_group" +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryBusinessGroupForTree(@Param("query") String query);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId} and business_group = #{businessGroup}")
|
||||
Group queryOneByDeviceId(@Param("deviceId") String deviceId, @Param("businessGroup") String businessGroup);
|
||||
|
||||
@Delete("<script>" +
|
||||
" DELETE FROM wvp_common_group WHERE id in " +
|
||||
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>")
|
||||
int batchDelete(List<Group> allChildren);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE device_id = #{businessGroup} and business_group = #{businessGroup} ")
|
||||
Group queryBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE business_group = #{businessGroup} ")
|
||||
List<Group> queryByBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Delete("DELETE FROM wvp_common_group WHERE business_group = #{businessGroup}")
|
||||
int deleteByBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Update(" UPDATE wvp_common_group " +
|
||||
" SET parent_device_id=#{group.deviceId}, business_group = #{group.businessGroup}" +
|
||||
" WHERE parent_id = #{parentId}")
|
||||
int updateChild(@Param("parentId") Integer parentId, Group group);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * from wvp_common_group " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" </script>")
|
||||
List<Group> queryInGroupListByDeviceId(List<Group> groupList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_group " +
|
||||
" where (device_id, business_group) in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > (#{item.gbParentId}, #{item.gbBusinessGroupId})</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryInChannelList(List<CommonGBChannel> channelList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_group " +
|
||||
" where id in " +
|
||||
" <foreach collection='groupSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryParentInChannelList(Set<Group> groupSet);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" wcg.device_id as gb_device_id," +
|
||||
" wcg.name as gb_name," +
|
||||
" wcg.business_group as gb_business_group_id," +
|
||||
" 1 as gb_parental," +
|
||||
" wcg.parent_device_id as gb_parent_id" +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id" +
|
||||
" where wpg.platform_id = #{platformId} " +
|
||||
" </script>")
|
||||
List<CommonGBChannel> queryForPlatform(@Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id is null and wcg.device_id in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbParentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryNotShareGroupForPlatformByChannelList(List<CommonGBChannel> channelList, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id IS NULL and wcg.id in " +
|
||||
" <foreach collection='allGroup' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryNotShareGroupForPlatformByGroupList(Set<Group> allGroup, @Param("platformId") Integer platformId);
|
||||
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_group " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbParentId}</foreach>" +
|
||||
" order by id " +
|
||||
"</script>")
|
||||
Set<Group> queryByChannelList(List<CommonGBChannel> channelList);
|
||||
|
||||
@Update(value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" inner join (select * from wvp_common_group ) w2 on w1.parent_device_id = w2.device_id " +
|
||||
" set w1.parent_id = w2.id" +
|
||||
" where w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "mysql")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_group w1\n" +
|
||||
" set parent_id = w2.id\n" +
|
||||
" from wvp_common_group w2\n" +
|
||||
" where w1.parent_device_id = w2.device_id\n" +
|
||||
" and w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "postgresql")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_group w1\n" +
|
||||
" set parent_id = w2.id\n" +
|
||||
" from wvp_common_group w2\n" +
|
||||
" where w1.parent_device_id = w2.device_id\n" +
|
||||
" and w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "kingbase")
|
||||
void updateParentId(List<Group> groupListForAdd);
|
||||
|
||||
@Update(value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" inner join (select * from wvp_common_group ) w2" +
|
||||
" on w1.parent_device_id is null" +
|
||||
" and w2.parent_device_id is null" +
|
||||
" and w2.device_id = w2.business_group " +
|
||||
" and w1.business_group = w2.device_id " +
|
||||
" and w1.device_id != w1.business_group " +
|
||||
" set w1.parent_id = w2.id" +
|
||||
" where w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "mysql")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" set parent_id = w2.id " +
|
||||
" from wvp_common_group w2 " +
|
||||
" where w1.parent_device_id is null " +
|
||||
" and w2.parent_device_id is null " +
|
||||
" and w2.device_id = w2.business_group " +
|
||||
" and w1.business_group = w2.device_id " +
|
||||
" and w1.device_id != w1.business_group " +
|
||||
" and w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "kingbase")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" set parent_id = w2.id " +
|
||||
" from wvp_common_group w2 " +
|
||||
" where w1.parent_device_id is null " +
|
||||
" and w2.parent_device_id is null " +
|
||||
" and w2.device_id = w2.business_group " +
|
||||
" and w1.business_group = w2.device_id " +
|
||||
" and w1.device_id != w1.business_group " +
|
||||
" and w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "postgresql")
|
||||
void updateParentIdWithBusinessGroup(List<Group> groupListForAdd);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" wp.* " +
|
||||
" from wvp_platform_group wpg " +
|
||||
" left join wvp_platform wp on wp.id = wpg.platform_id " +
|
||||
" where wpg.group_id = #{groupId} " +
|
||||
"</script>")
|
||||
List<Platform> queryForPlatformByGroupId(@Param("groupId") int groupId);
|
||||
|
||||
@Delete("DELETE FROM wvp_platform_group WHERE group_id = #{groupId}")
|
||||
void deletePlatformGroup(@Param("groupId") int groupId);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.genersoft.iot.vmp.gb28181.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -12,533 +13,65 @@ import java.util.Set;
|
|||
@Repository
|
||||
public interface PlatformChannelMapper {
|
||||
|
||||
|
||||
@Insert("<script> "+
|
||||
"INSERT INTO wvp_platform_channel (platform_id, device_channel_id) VALUES" +
|
||||
"<foreach collection='channelList' item='item' separator=','>" +
|
||||
" (#{platformId}, #{item.gbId} )" +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
int addChannels(@Param("platformId") Integer platformId, @Param("channelList") List<CommonGBChannel> channelList);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_channel WHERE device_channel_id in " +
|
||||
"( select temp.device_channel_id from " +
|
||||
"(select pgc.device_channel_id from wvp_platform_channel pgc " +
|
||||
"left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.channel_type = 0 and dc.device_id =#{deviceId} " +
|
||||
") temp)" +
|
||||
"</script>")
|
||||
int delChannelForDeviceId(String deviceId);
|
||||
|
||||
@Select("select d.*\n" +
|
||||
"from wvp_platform_channel pgc\n" +
|
||||
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
|
||||
" left join wvp_device d on dc.device_id = d.device_id\n" +
|
||||
"where dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
|
||||
List<Device> queryDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||
|
||||
@Select("<script> " +
|
||||
" SELECT " +
|
||||
" wp.* " +
|
||||
" FROM " +
|
||||
" wvp_platform wp " +
|
||||
" left join wvp_platform_channel wpgc on " +
|
||||
" wp.id = wpgc.platform_id " +
|
||||
" WHERE " +
|
||||
" wpgc.device_channel_id = #{channelId} and wp.status = true " +
|
||||
" AND wp.server_gb_id in " +
|
||||
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
"</script> ")
|
||||
List<Platform> queryPlatFormListForGBWithGBId(@Param("channelId") Integer channelId, List<String> platforms);
|
||||
|
||||
@Select("select dc.channel_id, dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
|
||||
"from wvp_platform_channel pgc\n" +
|
||||
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
|
||||
" left join wvp_device d on dc.device_id = d.device_id\n" +
|
||||
"where dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
|
||||
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||
|
||||
@Select("SELECT pgc.* from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_type = 0 and dc.device_id=#{channelId}")
|
||||
List<Platform> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" wpgc.id ,\n" +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type ,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" wpgc.custom_device_id, \n" +
|
||||
" wpgc.custom_name, \n" +
|
||||
" wpgc.custom_manufacturer, \n" +
|
||||
" wpgc.custom_model, \n" +
|
||||
" wpgc.custom_owner, \n" +
|
||||
" wpgc.custom_civil_code,\n" +
|
||||
" wpgc.custom_block, \n" +
|
||||
" wpgc.custom_address,\n" +
|
||||
" wpgc.custom_parental, \n" +
|
||||
" wpgc.custom_parent_id, \n" +
|
||||
" wpgc.custom_safety_way, \n" +
|
||||
" wpgc.custom_register_way, \n" +
|
||||
" wpgc.custom_cert_num, \n" +
|
||||
" wpgc.custom_certifiable, \n" +
|
||||
" wpgc.custom_err_code, \n" +
|
||||
" wpgc.custom_end_time, \n" +
|
||||
" wpgc.custom_secrecy, \n" +
|
||||
" wpgc.custom_ip_address, \n" +
|
||||
" wpgc.custom_port, \n" +
|
||||
" wpgc.custom_password, \n" +
|
||||
" wpgc.custom_status, \n" +
|
||||
" wpgc.custom_longitude, \n" +
|
||||
" wpgc.custom_latitude, \n" +
|
||||
" wpgc.custom_ptz_type, \n" +
|
||||
" wpgc.custom_position_type, \n" +
|
||||
" wpgc.custom_room_type, \n" +
|
||||
" wpgc.custom_use_type, \n" +
|
||||
" wpgc.custom_supply_light_type, \n" +
|
||||
" wpgc.custom_direction_type, \n" +
|
||||
" wpgc.custom_resolution, \n" +
|
||||
" wpgc.custom_business_group_id, \n" +
|
||||
" wpgc.custom_download_speed, \n" +
|
||||
" wpgc.custom_svc_space_support_mod,\n" +
|
||||
" wpgc.custom_svc_time_support_mode," +
|
||||
" coalesce( wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce( wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce( wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce( wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce( wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce( wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce( wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce( wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce( wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce( wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce( wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce( wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce( wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce( wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce( wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce( wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce( wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce( wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce( wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce( wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce( wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce( wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce( wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce( wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce( wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce( wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce( wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce( wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce( wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce( wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce( 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" +
|
||||
" wpgc.platform_id " +
|
||||
" from wvp_device_channel wdc" +
|
||||
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||
" where wdc.channel_type = 0 " +
|
||||
" <if test='query != null'> " +
|
||||
" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') OR wpgc.custom_device_id LIKE concat('%',#{query},'%') " +
|
||||
" OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') OR wpgc.custom_name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" <if test='online == true'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'ON'</if> " +
|
||||
" <if test='online == false'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF'</if> " +
|
||||
" <if test='hasShare == true'> AND wpgc.platform_id = #{platformId}</if> " +
|
||||
" <if test='hasShare == false'> AND wpgc.platform_id is null</if> " +
|
||||
" <if test='dataType != null'> AND wdc.data_type = #{dataType}</if> " +
|
||||
"</script>")
|
||||
List<PlatformChannel> queryForPlatformForWebList(@Param("platformId") Integer platformId, @Param("query") String query,
|
||||
@Param("dataType") Integer dataType, @Param("online") Boolean online,
|
||||
@Param("hasShare") Boolean hasShare);
|
||||
|
||||
@Select("select\n" +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wpgc.custom_svc_time_support_mode, 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_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" where wdc.channel_type = 0 and wpgc.platform_id = #{platformId} and coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId} order by wdc.id "
|
||||
|
||||
)
|
||||
List<CommonGBChannel> queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
|
||||
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wpgc.custom_svc_time_support_mode, 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_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||
" where wdc.channel_type = 0 and wpgc.platform_id is null" +
|
||||
"<if test='channelIds != null'> AND wdc.id in " +
|
||||
"<foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'> #{item} </foreach> " +
|
||||
"</if>" +
|
||||
"</script>")
|
||||
List<CommonGBChannel> queryNotShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wpgc.custom_svc_time_support_mode, 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_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" where wdc.channel_type = 0 and wpgc.platform_id = #{platformId}" +
|
||||
"<if test='channelIds != null'> AND wdc.id in " +
|
||||
" <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
|
||||
" #{item} " +
|
||||
" </foreach> " +
|
||||
"</if>" +
|
||||
" order by wdc.id" +
|
||||
"</script>")
|
||||
List<CommonGBChannel> queryShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
|
||||
|
||||
@Delete("<script> " +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId} " +
|
||||
"<if test='channelList != null'> AND device_channel_id in " +
|
||||
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
|
||||
" #{item.gbId} " +
|
||||
" </foreach> " +
|
||||
"</if>" +
|
||||
"</script>")
|
||||
int removeChannelsWithPlatform(@Param("platformId") Integer platformId, List<CommonGBChannel> channelList);
|
||||
|
||||
@Delete("<script> " +
|
||||
"DELETE from wvp_platform_channel WHERE " +
|
||||
"<if test='channelList != null'> AND device_channel_id in " +
|
||||
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
|
||||
" #{item.gbId} " +
|
||||
" </foreach> " +
|
||||
"</if>" +
|
||||
"</script>")
|
||||
int removeChannels(List<CommonGBChannel> channelList);
|
||||
|
||||
@Insert("<script> "+
|
||||
"INSERT INTO wvp_platform_group (platform_id, group_id) VALUES " +
|
||||
"<foreach collection='groupListNotShare' item='item' separator=','>" +
|
||||
" (#{platformId}, #{item.id} )" +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
int addPlatformGroup(Collection<Group> groupListNotShare, @Param("platformId") Integer platformId);
|
||||
|
||||
@Insert("<script> "+
|
||||
"INSERT INTO wvp_platform_region (platform_id, region_id) VALUES " +
|
||||
"<foreach collection='regionListNotShare' item='item' separator=','>" +
|
||||
" (#{platformId}, #{item.id} )" +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
int addPlatformRegion(List<Region> regionListNotShare, @Param("platformId") Integer platformId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_group WHERE platform_id=#{platformId} AND group_id in" +
|
||||
"<foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
"</script>")
|
||||
int removePlatformGroup(List<Group> groupList, @Param("platformId") Integer platformId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_group WHERE platform_id=#{platformId} AND group_id =#{id}" +
|
||||
"</script>")
|
||||
void removePlatformGroupById(@Param("id") int id, @Param("platformId") Integer platformId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_region WHERE platform_id=#{platformId} AND region_id =#{id}" +
|
||||
"</script>")
|
||||
void removePlatformRegionById(@Param("id") int id, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcg.* " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id IS NOT NULL and wcg.parent_id = #{parentId} " +
|
||||
" </script>")
|
||||
Set<Group> queryShareChildrenGroup(@Param("parentId") Integer parentId, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcr.* " +
|
||||
" from wvp_common_region wcr" +
|
||||
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
|
||||
" where wpr.platform_id IS NOT NULL and wcr.parent_device_id = #{parentId} " +
|
||||
" </script>")
|
||||
Set<Region> queryShareChildrenRegion(@Param("parentId") String parentId, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcg.* " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id is not null and wcg.id in " +
|
||||
"<foreach collection='groupSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryShareParentGroupByGroupSet(Set<Group> groupSet, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcr.* " +
|
||||
" from wvp_common_region wcr" +
|
||||
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
|
||||
" where wpr.platform_id is not null and wcr.id in " +
|
||||
"<foreach collection='regionSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Region> queryShareParentRegionByRegionSet(Set<Region> regionSet, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select("<script> " +
|
||||
" SELECT " +
|
||||
" pp.* " +
|
||||
" FROM " +
|
||||
" wvp_platform pp " +
|
||||
" left join wvp_platform_channel pgc on " +
|
||||
" pp.id = pgc.platform_id " +
|
||||
" left join wvp_device_channel dc on " +
|
||||
" dc.id = pgc.device_channel_id " +
|
||||
" WHERE " +
|
||||
" pgc.device_channel_id IN" +
|
||||
"<foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
"</script> ")
|
||||
List<Platform> queryPlatFormListByChannelList(Collection<Integer> ids);
|
||||
|
||||
@Select("<script> " +
|
||||
" SELECT " +
|
||||
" pp.* " +
|
||||
" FROM " +
|
||||
" wvp_platform pp " +
|
||||
" left join wvp_platform_channel pgc on " +
|
||||
" pp.id = pgc.platform_id " +
|
||||
" left join wvp_device_channel dc on " +
|
||||
" dc.id = pgc.device_channel_id " +
|
||||
" WHERE " +
|
||||
" pgc.device_channel_id = #{channelId}" +
|
||||
"</script> ")
|
||||
List<Platform> queryPlatFormListByChannelId(@Param("channelId") int channelId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId}" +
|
||||
"</script>")
|
||||
void removeChannelsByPlatformId(@Param("platformId") Integer platformId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_group WHERE platform_id=#{platformId}" +
|
||||
"</script>")
|
||||
void removePlatformGroupsByPlatformId(@Param("platformId") Integer platformId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_region WHERE platform_id=#{platformId}" +
|
||||
"</script>")
|
||||
void removePlatformRegionByPlatformId(@Param("platformId") Integer platformId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_platform_channel " +
|
||||
" SET custom_device_id =#{customDeviceId}" +
|
||||
" ,custom_name =#{customName}" +
|
||||
" ,custom_manufacturer =#{customManufacturer}" +
|
||||
" ,custom_model =#{customModel}" +
|
||||
" ,custom_owner =#{customOwner}" +
|
||||
" ,custom_civil_code =#{customCivilCode}" +
|
||||
" ,custom_block =#{customBlock}" +
|
||||
" ,custom_address =#{customAddress}" +
|
||||
" ,custom_parental =#{customParental}" +
|
||||
" ,custom_parent_id =#{customParentId}" +
|
||||
" ,custom_safety_way =#{customSafetyWay}" +
|
||||
" ,custom_register_way =#{customRegisterWay}" +
|
||||
" ,custom_cert_num =#{customCertNum}" +
|
||||
" ,custom_certifiable =#{customCertifiable}" +
|
||||
" ,custom_err_code =#{customErrCode}" +
|
||||
" ,custom_end_time =#{customEndTime}" +
|
||||
" ,custom_secrecy =#{customSecrecy}" +
|
||||
" ,custom_ip_address =#{customIpAddress}" +
|
||||
" ,custom_port =#{customPort}" +
|
||||
" ,custom_password =#{customPassword}" +
|
||||
" ,custom_status =#{customStatus}" +
|
||||
" ,custom_longitude =#{customLongitude}" +
|
||||
" ,custom_latitude =#{customLatitude}" +
|
||||
" ,custom_ptz_type =#{customPtzType}" +
|
||||
" ,custom_position_type =#{customPositionType}" +
|
||||
" ,custom_room_type =#{customRoomType}" +
|
||||
" ,custom_use_type =#{customUseType}" +
|
||||
" ,custom_supply_light_type =#{customSupplyLightType}" +
|
||||
" ,custom_direction_type =#{customDirectionType}" +
|
||||
" ,custom_resolution =#{customResolution}" +
|
||||
" ,custom_business_group_id =#{customBusinessGroupId}" +
|
||||
" ,custom_download_speed =#{customDownloadSpeed}" +
|
||||
" ,custom_svc_space_support_mod =#{customSvcSpaceSupportMod}" +
|
||||
" ,custom_svc_time_support_mode = #{customSvcTimeSupportMode}" +
|
||||
" WHERE id = #{id}"+
|
||||
" </script>"})
|
||||
void updateCustomChannel(PlatformChannel channel);
|
||||
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wpgc.custom_svc_time_support_mode, 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_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" where wdc.channel_type = 0 and wpgc.platform_id = #{platformId} and wdc.id = #{gbId}" +
|
||||
"</script>")
|
||||
CommonGBChannel queryShareChannel(@Param("platformId") int platformId, @Param("gbId") int gbId);
|
||||
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcg.* " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id " +
|
||||
" where wpg.platform_id = #{platformId}" +
|
||||
" order by wcg.id DESC" +
|
||||
" </script>")
|
||||
Set<Group> queryShareGroup(@Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcr.* " +
|
||||
" from wvp_common_region wcr" +
|
||||
" left join wvp_platform_region wpr on wpr.region_id = wcr.id " +
|
||||
" where wpr.platform_id = #{platformId}" +
|
||||
" order by wcr.id DESC" +
|
||||
" </script>")
|
||||
Set<Region> queryShareRegion(Integer id);
|
||||
}
|
||||
|
|
|
@ -13,85 +13,24 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface PlatformMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
|
||||
" device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,status,catalog_group, update_time," +
|
||||
" create_time, as_message_channel, send_stream_ip, auto_push_channel, catalog_with_platform,catalog_with_group,catalog_with_region, "+
|
||||
" civil_code,manufacturer,model,address,register_way,secrecy) " +
|
||||
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIp}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
|
||||
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{status}, #{catalogGroup},#{updateTime}," +
|
||||
" #{createTime}, #{asMessageChannel}, #{sendStreamIp}, #{autoPushChannel}, #{catalogWithPlatform}, #{catalogWithGroup},#{catalogWithRegion}, " +
|
||||
" #{civilCode}, #{manufacturer}, #{model}, #{address}, #{registerWay}, #{secrecy})")
|
||||
int add(Platform parentPlatform);
|
||||
|
||||
@Update("UPDATE wvp_platform " +
|
||||
"SET update_time = #{updateTime}," +
|
||||
" enable=#{enable}, " +
|
||||
" name=#{name}," +
|
||||
" server_gb_id=#{serverGBId}, " +
|
||||
" server_gb_domain=#{serverGBDomain}, " +
|
||||
" server_ip=#{serverIp}," +
|
||||
" server_port=#{serverPort}, " +
|
||||
" device_gb_id=#{deviceGBId}," +
|
||||
" device_ip=#{deviceIp}, " +
|
||||
" device_port=#{devicePort}, " +
|
||||
" username=#{username}, " +
|
||||
" password=#{password}, " +
|
||||
" expires=#{expires}, " +
|
||||
" keep_timeout=#{keepTimeout}, " +
|
||||
" transport=#{transport}, " +
|
||||
" character_set=#{characterSet}, " +
|
||||
" ptz=#{ptz}, " +
|
||||
" rtcp=#{rtcp}, " +
|
||||
" status=#{status}, " +
|
||||
" catalog_group=#{catalogGroup}, " +
|
||||
" as_message_channel=#{asMessageChannel}, " +
|
||||
" send_stream_ip=#{sendStreamIp}, " +
|
||||
" auto_push_channel=#{autoPushChannel}, " +
|
||||
" catalog_with_platform=#{catalogWithPlatform}, " +
|
||||
" catalog_with_group=#{catalogWithGroup}, " +
|
||||
" catalog_with_region=#{catalogWithRegion}, " +
|
||||
" civil_code=#{civilCode}, " +
|
||||
" manufacturer=#{manufacturer}, " +
|
||||
" model=#{model}, " +
|
||||
" address=#{address}, " +
|
||||
" register_way=#{registerWay}, " +
|
||||
" secrecy=#{secrecy} " +
|
||||
"WHERE id=#{id}")
|
||||
int update(Platform parentPlatform);
|
||||
|
||||
@Delete("DELETE FROM wvp_platform WHERE id=#{id}")
|
||||
int delete(@Param("id") Integer id);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT pp.*, " +
|
||||
" ( (SELECT count(0) FROM wvp_platform_channel pc WHERE pc.platform_id = pp.id ) + " +
|
||||
" (SELECT count(0) FROM wvp_platform_group pg WHERE pg.platform_id = pp.id ) * pp.catalog_with_group + " +
|
||||
" (SELECT count(0) FROM wvp_platform_region pr WHERE pr.platform_id = pp.id ) * pp.catalog_with_region + " +
|
||||
" pp.catalog_with_platform " +
|
||||
" ) as channel_count" +
|
||||
" FROM wvp_platform pp where 1=1 " +
|
||||
" <if test='query != null'> " +
|
||||
" AND (pp.name LIKE concat('%',#{query},'%') escape '/' OR pp.server_gb_id LIKE concat('%',#{query},'%') escape '/' )</if> " +
|
||||
" order by pp.id desc"+
|
||||
" </script>")
|
||||
List<Platform> queryList(@Param("query") String query);
|
||||
|
||||
@Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
|
||||
List<Platform> getEnableParentPlatformList(boolean enable);
|
||||
|
||||
@Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
|
||||
List<Platform> queryEnablePlatformListWithAsMessageChannel();
|
||||
|
||||
@Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{platformGbId}")
|
||||
Platform getParentPlatByServerGBId(String platformGbId);
|
||||
|
||||
@Select("SELECT * FROM wvp_platform WHERE id=#{id}")
|
||||
Platform query(int id);
|
||||
|
||||
@Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" )
|
||||
int updateStatus(@Param("platformGbID") String platformGbID, @Param("online") boolean online);
|
||||
|
||||
@Select("SELECT * FROM wvp_platform WHERE enable=true")
|
||||
List<Platform> queryEnablePlatformList();
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.genersoft.iot.vmp.gb28181.dao;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Region;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.RegionTree;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -11,172 +13,46 @@ import java.util.Set;
|
|||
@Mapper
|
||||
public interface RegionMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_common_region (device_id, name, parent_id, parent_device_id, create_time, update_time) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{createTime}, #{updateTime})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
void add(Region region);
|
||||
|
||||
@Delete("DELETE FROM wvp_common_region WHERE id=#{id}")
|
||||
int delete(@Param("id") int id);
|
||||
|
||||
@Update(" UPDATE wvp_common_region " +
|
||||
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, parent_device_id=#{parentDeviceId}" +
|
||||
" WHERE id = #{id}")
|
||||
int update(Region region);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * from wvp_common_region WHERE 1=1 " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') escape '/' OR name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" <if test='parentId != null'> AND parent_device_id = #{parentId}</if> " +
|
||||
"ORDER BY id " +
|
||||
" </script>"})
|
||||
List<Region> query(@Param("query") String query, @Param("parentId") String parentId);
|
||||
|
||||
@Select("SELECT * from wvp_common_region WHERE parent_id = #{parentId} ORDER BY id ")
|
||||
List<Region> getChildren(@Param("parentId") Integer parentId);
|
||||
|
||||
@Select("SELECT * from wvp_common_region WHERE id = #{id} ")
|
||||
Region queryOne(@Param("id") int id);
|
||||
|
||||
@Select(" select dc.civil_code as civil_code " +
|
||||
" from wvp_device_channel dc " +
|
||||
" where dc.civil_code not in " +
|
||||
" (select device_id from wvp_common_region)")
|
||||
List<String> getUninitializedCivilCode();
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT device_id from wvp_common_region " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='codes' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>")
|
||||
List<String> queryInList(Set<String> codes);
|
||||
|
||||
|
||||
@Insert(" <script>" +
|
||||
" INSERT INTO wvp_common_region (" +
|
||||
" device_id," +
|
||||
" name, " +
|
||||
" parent_device_id," +
|
||||
" parent_id," +
|
||||
" create_time," +
|
||||
" update_time) " +
|
||||
" VALUES " +
|
||||
" <foreach collection='regionList' index='index' item='item' separator=','> " +
|
||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId},#{item.parentId},#{item.createTime},#{item.updateTime})" +
|
||||
" </foreach> " +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int batchAdd(List<Region> regionList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" *, " +
|
||||
" concat('region', id) as tree_id," +
|
||||
" 0 as type," +
|
||||
" 'ON' as status," +
|
||||
" false as is_leaf" +
|
||||
" from wvp_common_region " +
|
||||
" where " +
|
||||
" <if test='parentId != null'> parent_id = #{parentId} </if> " +
|
||||
" <if test='parentId == null'> parent_id is null </if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') escape '/' OR name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" </script>")
|
||||
List<RegionTree> queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
|
||||
|
||||
@Delete("<script>" +
|
||||
" DELETE FROM wvp_common_region WHERE id in " +
|
||||
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>")
|
||||
void batchDelete(List<Region> allChildren);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * from wvp_common_region " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" </script>")
|
||||
List<Region> queryInRegionListByDeviceId(List<Region> regionList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" wcr.device_id as gb_device_id," +
|
||||
" wcr.name as gb_name" +
|
||||
" from wvp_common_region wcr" +
|
||||
" left join wvp_platform_region wpr on wcr.id = wpr.region_id" +
|
||||
" where wpr.platform_id = #{platformId} " +
|
||||
" </script>")
|
||||
List<CommonGBChannel> queryByPlatform(@Param("platformId") Integer platformId);
|
||||
|
||||
|
||||
@Update(value = " <script>" +
|
||||
" update wvp_common_region w1 " +
|
||||
" inner join (select * from wvp_common_region ) w2 on w1.parent_device_id = w2.device_id " +
|
||||
" set w1.parent_id = w2.id" +
|
||||
" where w1.id in " +
|
||||
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "mysql")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_region w1\n" +
|
||||
" set parent_id = w2.id\n" +
|
||||
" from wvp_common_region w2\n" +
|
||||
" where w1.parent_device_id = w2.device_id\n" +
|
||||
" and w1.id in " +
|
||||
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "kingbase")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_region w1\n" +
|
||||
" set parent_id = w2.id\n" +
|
||||
" from wvp_common_region w2\n" +
|
||||
" where w1.parent_device_id = w2.device_id\n" +
|
||||
" and w1.id in " +
|
||||
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "postgresql")
|
||||
void updateParentId(List<Region> regionListForAdd);
|
||||
|
||||
@Update(" <script>" +
|
||||
" update wvp_common_region" +
|
||||
" set parent_device_id = #{parentDeviceId}" +
|
||||
" where parent_id = #{parentId} " +
|
||||
" </script>")
|
||||
void updateChild(@Param("parentId") int parentId, @Param("parentDeviceId") String parentDeviceId);
|
||||
|
||||
@Select("SELECT * from wvp_common_region WHERE device_id = #{deviceId} ")
|
||||
Region queryByDeviceId(@Param("deviceId") String deviceId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_region " +
|
||||
" where id in " +
|
||||
" <foreach collection='regionSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Region> queryParentInChannelList(Set<Region> regionSet);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_region " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbCivilCode}</foreach>" +
|
||||
" order by id " +
|
||||
"</script>")
|
||||
Set<Region> queryByChannelList(List<CommonGBChannel> channelList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * " +
|
||||
" from wvp_common_region wcr" +
|
||||
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
|
||||
" where wpr.platform_id is null and wcr.device_id in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbCivilCode}</foreach>" +
|
||||
" </script>")
|
||||
Set<Region> queryNotShareRegionForPlatformByChannelList(List<CommonGBChannel> channelList, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * " +
|
||||
" from wvp_common_region wcr" +
|
||||
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
|
||||
" where wpr.platform_id IS NULL and wcr.id in " +
|
||||
" <foreach collection='allRegion' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>")
|
||||
Set<Region> queryNotShareRegionForPlatformByRegionList(Set<Region> allRegion, @Param("platformId") Integer platformId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,367 +0,0 @@
|
|||
package com.genersoft.iot.vmp.gb28181.dao.provider;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChannelProvider {
|
||||
|
||||
public final static String BASE_SQL = "select\n" +
|
||||
" id as gb_id,\n" +
|
||||
" data_type,\n" +
|
||||
" data_device_id,\n" +
|
||||
" create_time,\n" +
|
||||
" update_time,\n" +
|
||||
" record_plan_id,\n" +
|
||||
" coalesce(gb_device_id, device_id) as gb_device_id,\n" +
|
||||
" coalesce(gb_name, name) as gb_name,\n" +
|
||||
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as gb_model,\n" +
|
||||
" coalesce(gb_owner, owner) as gb_owner,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(gb_block, block) as gb_block,\n" +
|
||||
" coalesce(gb_address, address) as gb_address,\n" +
|
||||
" coalesce(gb_parental, parental) as gb_parental,\n" +
|
||||
" coalesce(gb_parent_id, parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(gb_safety_way, safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(gb_register_way, register_way) as gb_register_way,\n" +
|
||||
" coalesce(gb_cert_num, cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(gb_certifiable, certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(gb_err_code, err_code) as gb_err_code,\n" +
|
||||
" coalesce(gb_end_time, end_time) as gb_end_time,\n" +
|
||||
" coalesce(gb_secrecy, secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(gb_ip_address, ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(gb_port, port) as gb_port,\n" +
|
||||
" coalesce(gb_password, password) as gb_password,\n" +
|
||||
" coalesce(gb_status, status) as gb_status,\n" +
|
||||
" coalesce(gb_longitude, longitude) as gb_longitude,\n" +
|
||||
" coalesce(gb_latitude, latitude) as gb_latitude,\n" +
|
||||
" coalesce(gb_ptz_type, ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(gb_position_type, position_type) as gb_position_type,\n" +
|
||||
" coalesce(gb_room_type, room_type) as gb_room_type,\n" +
|
||||
" coalesce(gb_use_type, use_type) as gb_use_type,\n" +
|
||||
" coalesce(gb_supply_light_type, supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(gb_direction_type, direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(gb_resolution, resolution) as gb_resolution,\n" +
|
||||
" 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" +
|
||||
" from wvp_device_channel\n"
|
||||
;
|
||||
|
||||
private final static String BASE_SQL_FOR_PLATFORM =
|
||||
"select\n" +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wpgc.custom_svc_time_support_mode, 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_channel wpgc on wdc.id = wpgc.device_channel_id"
|
||||
;
|
||||
|
||||
public String queryByDeviceId(Map<String, Object> params ){
|
||||
return BASE_SQL + " where channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
|
||||
}
|
||||
|
||||
public String queryById(Map<String, Object> params ){
|
||||
return BASE_SQL + " where channel_type = 0 and id = #{gbId}";
|
||||
}
|
||||
|
||||
public String queryByDataId(Map<String, Object> params ){
|
||||
return BASE_SQL + " where channel_type = 0 and data_type = #{dataType} and data_device_id = #{dataDeviceId}";
|
||||
}
|
||||
|
||||
public String queryListByCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append(" where channel_type = 0 ");
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )")
|
||||
;
|
||||
}
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("civilCode") != null) {
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) = #{civilCode}");
|
||||
}else {
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) is null");
|
||||
}
|
||||
if (params.get("dataType") != null) {
|
||||
sqlBuild.append(" AND data_type = #{dataType}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListByParentId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append(" where channel_type = 0 ");
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )")
|
||||
;
|
||||
}
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("groupDeviceId") != null) {
|
||||
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) = #{groupDeviceId}");
|
||||
}else {
|
||||
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) is null");
|
||||
}
|
||||
if (params.get("dataType") != null) {
|
||||
sqlBuild.append(" AND data_type = #{dataType}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryList(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append(" where channel_type = 0 ");
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )")
|
||||
;
|
||||
}
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("hasRecordPlan") != null && (Boolean)params.get("hasRecordPlan")) {
|
||||
sqlBuild.append(" AND record_plan_id > 0");
|
||||
}
|
||||
if (params.get("dataType") != null) {
|
||||
sqlBuild.append(" AND data_type = #{dataType}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryInListByStatus(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and gb_status=#{status} and id in ( ");
|
||||
|
||||
List<CommonGBChannel> commonGBChannelList = (List<CommonGBChannel>)params.get("commonGBChannelList");
|
||||
boolean first = true;
|
||||
for (CommonGBChannel channel : commonGBChannelList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(channel.getGbId());
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and id in ( ");
|
||||
|
||||
Collection<Integer> ids = (Collection<Integer>)params.get("ids");
|
||||
boolean first = true;
|
||||
for (Integer id : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(id);
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByGbDeviceIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
|
||||
|
||||
Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
|
||||
boolean first = true;
|
||||
for (Integer id : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(id);
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByDeviceIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and id in ( ");
|
||||
|
||||
Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
|
||||
boolean first = true;
|
||||
for (Integer id : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(id);
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByIdsOrCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and ");
|
||||
if (params.get("civilCode") != null) {
|
||||
sqlBuild.append(" coalesce(gb_civil_code, civil_code) = #{civilCode} ");
|
||||
if (params.get("ids") != null) {
|
||||
sqlBuild.append(" OR ");
|
||||
}
|
||||
}
|
||||
if (params.get("ids") != null) {
|
||||
sqlBuild.append(" id in ( ");
|
||||
Collection<Integer> ids = (Collection<Integer>)params.get("ids");
|
||||
boolean first = true;
|
||||
for (Integer id : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(id);
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
}
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and coalesce(gb_civil_code, civil_code) = #{civilCode} ");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryByBusinessGroup(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and coalesce(gb_business_group_id, business_group_id) = #{businessGroup} ");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByParentId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and gb_parent_id = #{parentId} ");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByGroupList(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
|
||||
sqlBuild.append(" where channel_type = 0 and gb_parent_id in ( ");
|
||||
Collection<Group> ids = (Collection<Group>)params.get("groupList");
|
||||
boolean first = true;
|
||||
for (Group group : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(group.getDeviceId());
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryListByStreamPushList(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
|
||||
sqlBuild.append(" where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
|
||||
Collection<StreamPush> ids = (Collection<StreamPush>)params.get("streamPushList");
|
||||
boolean first = true;
|
||||
for (StreamPush streamPush : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(streamPush.getId());
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryWithPlatform(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_PLATFORM);
|
||||
sqlBuild.append(" where wpgc.platform_id = #{platformId}");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryShareChannelByParentId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_PLATFORM);
|
||||
sqlBuild.append(" where wpgc.platform_id = #{platformId} and coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) = #{parentId}");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryShareChannelByCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_PLATFORM);
|
||||
sqlBuild.append(" where wpgc.platform_id = #{platformId} and coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) = #{civilCode}");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
package com.genersoft.iot.vmp.gb28181.dao.provider;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DeviceChannelProvider {
|
||||
|
||||
public String getBaseSelectSql(){
|
||||
return "SELECT " +
|
||||
" dc.id,\n" +
|
||||
" dc.data_device_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" +
|
||||
" dc.channel_type,\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 "
|
||||
;
|
||||
}
|
||||
public String queryChannels(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId} ");
|
||||
if (params.get("businessGroupId") != null ) {
|
||||
sqlBuild.append(" AND coalesce(dc.gb_business_group_id, dc.business_group_id)=#{businessGroupId} AND coalesce(dc.gb_parent_id, dc.parent_id) is null");
|
||||
}else if (params.get("parentChannelId") != null ) {
|
||||
sqlBuild.append(" AND coalesce(dc.gb_parent_id, dc.parent_id)=#{parentChannelId}");
|
||||
}
|
||||
if (params.get("civilCode") != null ) {
|
||||
sqlBuild.append(" AND (coalesce(dc.gb_civil_code, dc.civil_code) = #{civilCode} " +
|
||||
"OR (LENGTH(coalesce(dc.gb_device_id, dc.device_id))=LENGTH(#{civilCode}) + 2) AND coalesce(dc.gb_device_id, dc.device_id) LIKE concat(#{civilCode},'%'))");
|
||||
}
|
||||
if (params.get("query") != null && !ObjectUtils.isEmpty(params.get("query"))) {
|
||||
sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') escape '/'" +
|
||||
" OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') escape '/')")
|
||||
;
|
||||
}
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("hasSubChannel") != null && (Boolean)params.get("hasSubChannel")) {
|
||||
sqlBuild.append(" AND dc.sub_count > 0");
|
||||
}
|
||||
if (params.get("hasSubChannel") != null && !(Boolean)params.get("hasSubChannel")) {
|
||||
sqlBuild.append(" AND dc.sub_count = 0");
|
||||
}
|
||||
List<String> channelIds = (List<String>)params.get("channelIds");
|
||||
if (channelIds != null && !channelIds.isEmpty()) {
|
||||
sqlBuild.append(" AND dc.device_id in (");
|
||||
boolean first = true;
|
||||
for (String id : channelIds) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(id);
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
|
||||
public String queryChannelsByDeviceDbId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryAllChannels(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String getOne(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where dc.id=#{id}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String getOneByDeviceId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id=#{dataDeviceId} and coalesce(dc.gb_device_id, dc.device_id) = #{channelId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String queryByDeviceId(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
|
||||
}
|
||||
|
||||
public String queryById(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and id = #{gbId}";
|
||||
}
|
||||
|
||||
|
||||
public String queryList(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" where channel_type = 0 and data_type = " + ChannelDataType.GB28181.value);
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" +
|
||||
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )")
|
||||
;
|
||||
}
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("hasCivilCode") != null && (Boolean)params.get("hasCivilCode")) {
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) is not null");
|
||||
}
|
||||
if (params.get("hasCivilCode") != null && !(Boolean)params.get("hasCivilCode")) {
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) is null");
|
||||
}
|
||||
if (params.get("hasGroup") != null && (Boolean)params.get("hasGroup")) {
|
||||
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) is not null");
|
||||
}
|
||||
if (params.get("hasGroup") != null && !(Boolean)params.get("hasGroup")) {
|
||||
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) is null");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
}
|
|
@ -2,124 +2,36 @@ package com.genersoft.iot.vmp.storager.dao;
|
|||
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CloudRecordServiceMapper {
|
||||
|
||||
@Insert(" <script>" +
|
||||
"INSERT INTO wvp_cloud_record (" +
|
||||
" app," +
|
||||
" stream," +
|
||||
"<if test=\"callId != null\"> call_id,</if>" +
|
||||
" start_time," +
|
||||
" end_time," +
|
||||
" media_server_id," +
|
||||
" file_name," +
|
||||
" folder," +
|
||||
" file_path," +
|
||||
" file_size," +
|
||||
" time_len ) " +
|
||||
"VALUES (" +
|
||||
" #{app}," +
|
||||
" #{stream}," +
|
||||
" <if test=\"callId != null\"> #{callId},</if>" +
|
||||
" #{startTime}," +
|
||||
" #{endTime}," +
|
||||
" #{mediaServerId}," +
|
||||
" #{fileName}," +
|
||||
" #{folder}," +
|
||||
" #{filePath}," +
|
||||
" #{fileSize}," +
|
||||
" #{timeLen})" +
|
||||
" </script>")
|
||||
int add(CloudRecordItem cloudRecordItem);
|
||||
|
||||
@Select(" <script>" +
|
||||
"select * " +
|
||||
" from wvp_cloud_record " +
|
||||
" where 0 = 0" +
|
||||
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') escape '/' OR stream LIKE concat('%',#{query},'%') escape '/' )</if> " +
|
||||
" <if test= 'app != null '> and app=#{app}</if>" +
|
||||
" <if test= 'stream != null '> and stream=#{stream}</if>" +
|
||||
" <if test= 'startTimeStamp != null '> and end_time >= #{startTimeStamp}</if>" +
|
||||
" <if test= 'endTimeStamp != null '> and start_time <= #{endTimeStamp}</if>" +
|
||||
" <if test= 'callId != null '> and call_id = #{callId}</if>" +
|
||||
" <if test= 'mediaServerItemList != null ' > and media_server_id in " +
|
||||
" <foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </if>" +
|
||||
" <if test= 'ids != null ' > and id in " +
|
||||
" <foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </if>" +
|
||||
" order by start_time desc" +
|
||||
" </script>")
|
||||
List<CloudRecordItem> getList(@Param("query") String query, @Param("app") String app, @Param("stream") String stream,
|
||||
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
|
||||
@Param("callId")String callId, List<MediaServer> mediaServerItemList,
|
||||
@Param("startTimeStamp") Long startTimeStamp, @Param("endTimeStamp") Long endTimeStamp,
|
||||
@Param("callId") String callId, List<MediaServer> mediaServerItemList,
|
||||
List<Integer> ids);
|
||||
|
||||
|
||||
@Select(" <script>" +
|
||||
"select file_path" +
|
||||
" from wvp_cloud_record " +
|
||||
" where 0 = 0" +
|
||||
" <if test= 'app != null '> and app=#{app}</if>" +
|
||||
" <if test= 'stream != null '> and stream=#{stream}</if>" +
|
||||
" <if test= 'startTimeStamp != null '> and end_time >= #{startTimeStamp}</if>" +
|
||||
" <if test= 'endTimeStamp != null '> and start_time <= #{endTimeStamp}</if>" +
|
||||
" <if test= 'callId != null '> and call_id = #{callId}</if>" +
|
||||
" <if test= 'mediaServerItemList != null ' > and media_server_id in " +
|
||||
" <foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </if>" +
|
||||
" </script>")
|
||||
List<String> queryRecordFilePathList(@Param("app") String app, @Param("stream") String stream,
|
||||
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
|
||||
@Param("callId")String callId, List<MediaServer> mediaServerItemList);
|
||||
@Param("startTimeStamp") Long startTimeStamp, @Param("endTimeStamp") Long endTimeStamp,
|
||||
@Param("callId") String callId, List<MediaServer> mediaServerItemList);
|
||||
|
||||
@Update(" <script>" +
|
||||
"update wvp_cloud_record set collect = #{collect} where file_path in " +
|
||||
" <foreach collection='cloudRecordItemList' item='item' open='(' separator=',' close=')' > #{item.filePath}</foreach>" +
|
||||
" </script>")
|
||||
int updateCollectList(@Param("collect") boolean collect, List<CloudRecordItem> cloudRecordItemList);
|
||||
|
||||
@Delete(" <script>" +
|
||||
"delete from wvp_cloud_record where media_server_id=#{mediaServerId} and file_path in " +
|
||||
" <foreach collection='filePathList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>")
|
||||
void deleteByFileList(List<String> filePathList, @Param("mediaServerId") String mediaServerId);
|
||||
|
||||
List<CloudRecordItem> queryRecordListForDelete(@Param("endTimeStamp") Long endTimeStamp, String mediaServerId);
|
||||
|
||||
@Select(" <script>" +
|
||||
"select *" +
|
||||
" from wvp_cloud_record " +
|
||||
" where collect = false and end_time <= #{endTimeStamp} and media_server_id = #{mediaServerId} " +
|
||||
" </script>")
|
||||
List<CloudRecordItem> queryRecordListForDelete(@Param("endTimeStamp")Long endTimeStamp, String mediaServerId);
|
||||
|
||||
@Update(" <script>" +
|
||||
"update wvp_cloud_record set collect = #{collect} where id = #{recordId} " +
|
||||
" </script>")
|
||||
int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId);
|
||||
|
||||
@Delete(" <script>" +
|
||||
"delete from wvp_cloud_record where id in " +
|
||||
" <foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>")
|
||||
int deleteList(List<CloudRecordItem> cloudRecordItemIdList);
|
||||
|
||||
@Select(" <script>" +
|
||||
"select *" +
|
||||
" from wvp_cloud_record " +
|
||||
"where call_id = #{callId}" +
|
||||
" </script>")
|
||||
List<CloudRecordItem> getListByCallId(@Param("callId") String callId);
|
||||
|
||||
@Select(" <script>" +
|
||||
"select *" +
|
||||
" from wvp_cloud_record " +
|
||||
"where id = #{id}" +
|
||||
" </script>")
|
||||
CloudRecordItem queryOne(@Param("id") Integer id);
|
||||
}
|
||||
|
|
|
@ -1,169 +1,35 @@
|
|||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface MediaServerMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_media_server (" +
|
||||
"id,"+
|
||||
"ip,"+
|
||||
"hook_ip,"+
|
||||
"sdp_ip,"+
|
||||
"stream_ip,"+
|
||||
"http_port,"+
|
||||
"http_ssl_port,"+
|
||||
"rtmp_port,"+
|
||||
"rtmp_ssl_port,"+
|
||||
"rtp_proxy_port,"+
|
||||
"rtsp_port,"+
|
||||
"flv_port," +
|
||||
"flv_ssl_port," +
|
||||
"ws_flv_port," +
|
||||
"ws_flv_ssl_port," +
|
||||
"rtsp_ssl_port,"+
|
||||
"auto_config,"+
|
||||
"secret,"+
|
||||
"rtp_enable,"+
|
||||
"rtp_port_range,"+
|
||||
"send_rtp_port_range,"+
|
||||
"record_assist_port,"+
|
||||
"record_day,"+
|
||||
"record_path,"+
|
||||
"default_server,"+
|
||||
"type,"+
|
||||
"create_time,"+
|
||||
"update_time,"+
|
||||
"transcode_suffix,"+
|
||||
"hook_alive_interval"+
|
||||
") VALUES " +
|
||||
"(" +
|
||||
"#{id}, " +
|
||||
"#{ip}, " +
|
||||
"#{hookIp}, " +
|
||||
"#{sdpIp}, " +
|
||||
"#{streamIp}, " +
|
||||
"#{httpPort}, " +
|
||||
"#{httpSSlPort}, " +
|
||||
"#{rtmpPort}, " +
|
||||
"#{rtmpSSlPort}, " +
|
||||
"#{rtpProxyPort}, " +
|
||||
"#{rtspPort}, " +
|
||||
"#{flvPort}, " +
|
||||
"#{flvSSLPort}, " +
|
||||
"#{wsFlvPort}, " +
|
||||
"#{wsFlvSSLPort}, " +
|
||||
"#{rtspSSLPort}, " +
|
||||
"#{autoConfig}, " +
|
||||
"#{secret}, " +
|
||||
"#{rtpEnable}, " +
|
||||
"#{rtpPortRange}, " +
|
||||
"#{sendRtpPortRange}, " +
|
||||
"#{recordAssistPort}, " +
|
||||
"#{recordDay}, " +
|
||||
"#{recordPath}, " +
|
||||
"#{defaultServer}, " +
|
||||
"#{type}, " +
|
||||
"#{createTime}, " +
|
||||
"#{updateTime}, " +
|
||||
"#{transcodeSuffix}, " +
|
||||
"#{hookAliveInterval})")
|
||||
int add(MediaServer mediaServerItem);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_media_server " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
"<if test=\"ip != null\">, ip=#{ip}</if>" +
|
||||
"<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
|
||||
"<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
|
||||
"<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" +
|
||||
"<if test=\"httpPort != null\">, http_port=#{httpPort}</if>" +
|
||||
"<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" +
|
||||
"<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" +
|
||||
"<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" +
|
||||
"<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
|
||||
"<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
|
||||
"<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
|
||||
"<if test=\"flvPort != null\">, flv_port=#{flvPort}</if>" +
|
||||
"<if test=\"flvSSLPort != null\">, flv_ssl_port=#{flvSSLPort}</if>" +
|
||||
"<if test=\"wsFlvPort != null\">, ws_flv_port=#{wsFlvPort}</if>" +
|
||||
"<if test=\"wsFlvSSLPort != null\">, ws_flv_ssl_port=#{wsFlvSSLPort}</if>" +
|
||||
"<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
|
||||
"<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
|
||||
"<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
|
||||
"<if test=\"sendRtpPortRange != null\">, send_rtp_port_range=#{sendRtpPortRange}</if>" +
|
||||
"<if test=\"secret != null\">, secret=#{secret}</if>" +
|
||||
"<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
|
||||
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
|
||||
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
|
||||
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
|
||||
"<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" +
|
||||
"<if test=\"type != null\">, type=#{type}</if>" +
|
||||
"WHERE id=#{id}"+
|
||||
" </script>"})
|
||||
int update(MediaServer mediaServerItem);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_media_server " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
"<if test=\"id != null\">, id=#{id}</if>" +
|
||||
"<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
|
||||
"<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
|
||||
"<if test=\"streamIp != null\">, stream_ip=#{streamIp}</if>" +
|
||||
"<if test=\"httpSSlPort != null\">, http_ssl_port=#{httpSSlPort}</if>" +
|
||||
"<if test=\"rtmpPort != null\">, rtmp_port=#{rtmpPort}</if>" +
|
||||
"<if test=\"rtmpSSlPort != null\">, rtmp_ssl_port=#{rtmpSSlPort}</if>" +
|
||||
"<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
|
||||
"<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
|
||||
"<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
|
||||
"<if test=\"flvPort != null\">, flv_port=#{flvPort}</if>" +
|
||||
"<if test=\"flvSSLPort != null\">, flv_ssl_port=#{flvSSLPort}</if>" +
|
||||
"<if test=\"wsFlvPort != null\">, ws_flv_port=#{wsFlvPort}</if>" +
|
||||
"<if test=\"wsFlvSSLPort != null\">, ws_flv_ssl_port=#{wsFlvSSLPort}</if>" +
|
||||
"<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
|
||||
"<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
|
||||
"<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
|
||||
"<if test=\"sendRtpPortRange != null\">, send_rtp_port_range=#{sendRtpPortRange}</if>" +
|
||||
"<if test=\"secret != null\">, secret=#{secret}</if>" +
|
||||
"<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
|
||||
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
|
||||
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
|
||||
"<if test=\"type != null\">, type=#{type}</if>" +
|
||||
"<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" +
|
||||
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
|
||||
"WHERE ip=#{ip} and http_port=#{httpPort}"+
|
||||
" </script>"})
|
||||
|
||||
int updateByHostAndPort(MediaServer mediaServerItem);
|
||||
|
||||
@Select("SELECT * FROM wvp_media_server WHERE id=#{id}")
|
||||
MediaServer queryOne(String id);
|
||||
|
||||
@Select("SELECT * FROM wvp_media_server")
|
||||
List<MediaServer> queryAll();
|
||||
|
||||
@Delete("DELETE FROM wvp_media_server WHERE id=#{id}")
|
||||
void delOne(String id);
|
||||
|
||||
@Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
|
||||
void delOneByIPAndPort(@Param("host") String host, @Param("port") int port);
|
||||
|
||||
@Delete("DELETE FROM wvp_media_server WHERE default_server=true")
|
||||
int delDefault();
|
||||
|
||||
@Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
|
||||
MediaServer queryOneByHostAndPort(@Param("host") String host, @Param("port") int port);
|
||||
|
||||
@Select("SELECT * FROM wvp_media_server WHERE default_server=true")
|
||||
MediaServer queryDefault();
|
||||
|
||||
@Select("SELECT * FROM wvp_media_server WHERE record_assist_port > 0")
|
||||
List<MediaServer> queryAllWithAssistPort();
|
||||
|
||||
}
|
||||
|
|
|
@ -2,66 +2,31 @@ package com.genersoft.iot.vmp.storager.dao;
|
|||
|
||||
import com.genersoft.iot.vmp.service.bean.RecordPlan;
|
||||
import com.genersoft.iot.vmp.service.bean.RecordPlanItem;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface RecordPlanMapper {
|
||||
|
||||
@Insert(" <script>" +
|
||||
"INSERT INTO wvp_record_plan (" +
|
||||
" name," +
|
||||
" snap," +
|
||||
" create_time," +
|
||||
" update_time) " +
|
||||
"VALUES (" +
|
||||
" #{name}," +
|
||||
" #{snap}," +
|
||||
" #{createTime}," +
|
||||
" #{updateTime})" +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
void add(RecordPlan plan);
|
||||
|
||||
@Insert(" <script>" +
|
||||
"INSERT INTO wvp_record_plan_item (" +
|
||||
"start," +
|
||||
"stop, " +
|
||||
"week_day," +
|
||||
"plan_id) " +
|
||||
"VALUES" +
|
||||
"<foreach collection='planItemList' index='index' item='item' separator=','> " +
|
||||
"(#{item.start}, #{item.stop}, #{item.weekDay},#{planId})" +
|
||||
"</foreach> " +
|
||||
" </script>")
|
||||
void batchAddItem(@Param("planId") int planId, List<RecordPlanItem> planItemList);
|
||||
|
||||
@Select("select * from wvp_record_plan where id = #{planId}")
|
||||
RecordPlan get(@Param("planId") Integer planId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wrp.*, (select count(1) from wvp_device_channel where record_plan_id = wrp.id) AS channelCount\n" +
|
||||
" FROM wvp_record_plan wrp where 1=1" +
|
||||
" <if test='query != null'> AND (name LIKE concat('%',#{query},'%') escape '/' )</if> " +
|
||||
" </script>")
|
||||
List<RecordPlan> query(@Param("query") String query);
|
||||
|
||||
@Update("UPDATE wvp_record_plan SET update_time=#{updateTime}, name=#{name}, snap=#{snap} WHERE id=#{id}")
|
||||
void update(RecordPlan plan);
|
||||
|
||||
@Delete("DELETE FROM wvp_record_plan WHERE id=#{planId}")
|
||||
void delete(@Param("planId") Integer planId);
|
||||
|
||||
@Select("select * from wvp_record_plan_item where plan_id = #{planId}")
|
||||
List<RecordPlanItem> getItemList(@Param("planId") Integer planId);
|
||||
|
||||
@Delete("DELETE FROM wvp_record_plan_item WHERE plan_id = #{planId}")
|
||||
void cleanItems(@Param("planId") Integer planId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" select wdc.id from wvp_device_channel wdc left join wvp_record_plan_item wrpi on wrpi.plan_id = wdc.record_plan_id " +
|
||||
" where wrpi.week_day = #{week} and wrpi.start <= #{index} and stop >= #{index} group by wdc.id" +
|
||||
" </script>")
|
||||
List<Integer> queryRecordIng(@Param("week") int week, @Param("index") int index);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.Role;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -10,25 +10,13 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface RoleMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_user_role (name, authority, create_time, update_time) VALUES" +
|
||||
"(#{name}, #{authority}, #{createTime}, #{updateTime})")
|
||||
int add(Role role);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_user_role " +
|
||||
"SET update_time=#{updateTime} " +
|
||||
"<if test=\"name != null\">, name=#{name}</if>" +
|
||||
"<if test=\"authority != null\">, authority=#{authority}</if>" +
|
||||
"WHERE id != 1 and id=#{id}" +
|
||||
" </script>"})
|
||||
int update(Role role);
|
||||
|
||||
@Delete("DELETE from wvp_user_role WHERE id != 1 and id=#{id}")
|
||||
int delete(int id);
|
||||
|
||||
@Select("select * from wvp_user_role WHERE id=#{id}")
|
||||
Role selectById(int id);
|
||||
|
||||
@Select("select * from wvp_user_role")
|
||||
List<Role> selectAll();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.UserApiKey;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.SelectKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -9,53 +11,29 @@ import java.util.List;
|
|||
@Mapper
|
||||
@Repository
|
||||
public interface UserApiKeyMapper {
|
||||
|
||||
@SelectKey(databaseId = "postgresql", statement = "SELECT currval('wvp_user_api_key_id_seq'::regclass) AS id", keyProperty = "id", before = false, resultType = Integer.class)
|
||||
@SelectKey(databaseId = "mysql", statement = "SELECT LAST_INSERT_ID() AS id", keyProperty = "id", before = false, resultType = Integer.class)
|
||||
@Insert("INSERT INTO wvp_user_api_key (user_id, app, api_key, expired_at, remark, enable, create_time, update_time) VALUES" +
|
||||
"(#{userId}, #{app}, #{apiKey}, #{expiredAt}, #{remark}, #{enable}, #{createTime}, #{updateTime})")
|
||||
int add(UserApiKey userApiKey);
|
||||
|
||||
@Update(value = {"<script>" +
|
||||
"UPDATE wvp_user_api_key " +
|
||||
"SET update_time = #{updateTime} " +
|
||||
"<if test=\"app != null\">, app = #{app}</if>" +
|
||||
"<if test=\"apiKey != null\">, api_key = #{apiKey}</if>" +
|
||||
"<if test=\"expiredAt != null\">, expired_at = #{expiredAt}</if>" +
|
||||
"<if test=\"remark != null\">, username = #{remark}</if>" +
|
||||
"<if test=\"enable != null\">, enable = #{enable}</if>" +
|
||||
"WHERE id = #{id}" +
|
||||
" </script>"})
|
||||
int update(UserApiKey userApiKey);
|
||||
|
||||
@Update("UPDATE wvp_user_api_key SET enable = true WHERE id = #{id}")
|
||||
int enable(@Param("id") int id);
|
||||
|
||||
@Update("UPDATE wvp_user_api_key SET enable = false WHERE id = #{id}")
|
||||
int disable(@Param("id") int id);
|
||||
|
||||
@Update("UPDATE wvp_user_api_key SET api_key = #{apiKey} WHERE id = #{id}")
|
||||
int apiKey(@Param("id") int id, @Param("apiKey") String apiKey);
|
||||
|
||||
@Update("UPDATE wvp_user_api_key SET remark = #{remark} WHERE id = #{id}")
|
||||
int remark(@Param("id") int id, @Param("remark") String remark);
|
||||
|
||||
@Delete("DELETE FROM wvp_user_api_key WHERE id = #{id}")
|
||||
int delete(@Param("id") int id);
|
||||
|
||||
@Select("SELECT uak.id, uak.user_id, uak.app, uak.api_key, uak.expired_at, uak.remark, uak.enable, uak.create_time, uak.update_time, u.username AS username FROM wvp_user_api_key uak LEFT JOIN wvp_user u on u.id = uak.user_id WHERE uak.id = #{id}")
|
||||
UserApiKey selectById(@Param("id") int id);
|
||||
|
||||
@Select("SELECT uak.id, uak.user_id, uak.app, uak.api_key, uak.expired_at, uak.remark, uak.enable, uak.create_time, uak.update_time, u.username AS username FROM wvp_user_api_key uak LEFT JOIN wvp_user u on u.id = uak.user_id WHERE uak.api_key = #{apiKey}")
|
||||
UserApiKey selectByApiKey(@Param("apiKey") String apiKey);
|
||||
|
||||
@Select("SELECT uak.id, uak.user_id, uak.app, uak.api_key, uak.expired_at, uak.remark, uak.enable, uak.create_time, uak.update_time, u.username AS username FROM wvp_user_api_key uak LEFT JOIN wvp_user u on u.id = uak.user_id")
|
||||
List<UserApiKey> selectAll();
|
||||
|
||||
@Select("SELECT uak.id, uak.user_id, uak.app, uak.api_key, uak.expired_at, uak.remark, uak.enable, uak.create_time, uak.update_time, u.username AS username FROM wvp_user_api_key uak LEFT JOIN wvp_user u on u.id = uak.user_id")
|
||||
List<UserApiKey> getUserApiKeys();
|
||||
|
||||
@Select("SELECT COUNT(0) FROM wvp_user_api_key WHERE api_key = #{apiKey}")
|
||||
boolean isApiKeyExists(@Param("apiKey") String apiKey);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
@ -11,50 +11,21 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface UserMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_user (username, password, role_id, push_key, create_time, update_time) VALUES" +
|
||||
"(#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})")
|
||||
int add(User user);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_user " +
|
||||
"SET update_time=#{updateTime} " +
|
||||
"<if test=\"pushKey != null\">, push_key=#{pushKey}</if>" +
|
||||
"<if test=\"role != null\">, role_id=#{role.id}</if>" +
|
||||
"<if test=\"password != null\">, password=#{password}</if>" +
|
||||
"<if test=\"username != null\">, username=#{username}</if>" +
|
||||
"WHERE id=#{id}" +
|
||||
" </script>"})
|
||||
int update(User user);
|
||||
|
||||
@Delete("DELETE from wvp_user WHERE id != 1 and id=#{id}")
|
||||
int delete(int id);
|
||||
|
||||
@Select("select u.*, r.name as roleName, r.authority as roleAuthority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.username=#{username} AND u.password=#{password}")
|
||||
@Results(id = "roleMap", value = {
|
||||
@Result(column = "role_id", property = "role.id"),
|
||||
@Result(column = "role_name", property = "role.name"),
|
||||
@Result(column = "role_authority", property = "role.authority"),
|
||||
@Result(column = "role_create_time", property = "role.createTime"),
|
||||
@Result(column = "role_update_time", property = "role.updateTime")
|
||||
})
|
||||
User select(@Param("username") String username, @Param("password") String password);
|
||||
|
||||
@Select("select u.*, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.id=#{id}")
|
||||
@ResultMap(value="roleMap")
|
||||
User selectById(int id);
|
||||
|
||||
@Select("select u.*, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.username=#{username}")
|
||||
@ResultMap(value="roleMap")
|
||||
User getUserByUsername(String username);
|
||||
|
||||
@Select("select u.*, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id")
|
||||
@ResultMap(value="roleMap")
|
||||
List<User> selectAll();
|
||||
|
||||
@Select("select u.id, u.username,u.push_key,u.role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u join wvp_user_role r on u.role_id=r.id")
|
||||
@ResultMap(value="roleMap")
|
||||
List<User> getUsers();
|
||||
|
||||
@Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}")
|
||||
int changePushKey(@Param("id") int id, @Param("pushKey") String pushKey);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.genersoft.iot.vmp.streamProxy.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
|
||||
import com.genersoft.iot.vmp.streamProxy.dao.provider.StreamProxyProvider;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -11,86 +12,34 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface StreamProxyMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_stream_proxy (type, app, stream,relates_media_server_id, src_url, " +
|
||||
"timeout, ffmpeg_cmd_key, rtsp_type, enable_audio, enable_mp4, enable, pulling, " +
|
||||
"enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES" +
|
||||
"(#{type}, #{app}, #{stream}, #{relatesMediaServerId}, #{srcUrl}, " +
|
||||
"#{timeout}, #{ffmpegCmdKey}, #{rtspType}, #{enableAudio}, #{enableMp4}, #{enable}, #{pulling}, " +
|
||||
"#{enableRemoveNoneReader}, #{enableDisableNoneReader}, #{createTime} )")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(StreamProxy streamProxyDto);
|
||||
|
||||
@Update("UPDATE wvp_stream_proxy " +
|
||||
"SET type=#{type}, " +
|
||||
"app=#{app}," +
|
||||
"stream=#{stream}," +
|
||||
"relates_media_server_id=#{relatesMediaServerId}, " +
|
||||
"src_url=#{srcUrl}," +
|
||||
"timeout=#{timeout}, " +
|
||||
"ffmpeg_cmd_key=#{ffmpegCmdKey}, " +
|
||||
"rtsp_type=#{rtspType}, " +
|
||||
"enable_audio=#{enableAudio}, " +
|
||||
"enable=#{enable}, " +
|
||||
"pulling=#{pulling}, " +
|
||||
"enable_remove_none_reader=#{enableRemoveNoneReader}, " +
|
||||
"enable_disable_none_reader=#{enableDisableNoneReader}, " +
|
||||
"enable_mp4=#{enableMp4} " +
|
||||
"WHERE id=#{id}")
|
||||
int update(StreamProxy streamProxyDto);
|
||||
|
||||
@Delete("DELETE FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
|
||||
int delByAppAndStream(String app, String stream);
|
||||
|
||||
@SelectProvider(type = StreamProxyProvider.class, method = "selectAll")
|
||||
List<StreamProxy> selectAll(@Param("query") String query, @Param("pulling") Boolean pulling, @Param("mediaServerId") String mediaServerId);
|
||||
|
||||
@SelectProvider(type = StreamProxyProvider.class, method = "selectOneByAppAndStream")
|
||||
StreamProxy selectOneByAppAndStream(@Param("app") String app, @Param("stream") String stream);
|
||||
|
||||
@SelectProvider(type = StreamProxyProvider.class, method = "selectForPushingInMediaServer")
|
||||
List<StreamProxy> selectForPushingInMediaServer(@Param("mediaServerId") String mediaServerId, @Param("enable") boolean enable);
|
||||
List<StreamProxy> selectForPushingInMediaServer(@Param("mediaServerId") String mediaServerId, @Param("enable") boolean enable);
|
||||
|
||||
|
||||
@Select("select count(1) from wvp_stream_proxy")
|
||||
int getAllCount();
|
||||
|
||||
@Select("select count(1) from wvp_stream_proxy where pulling = true")
|
||||
int getOnline();
|
||||
|
||||
@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 pulling=true " +
|
||||
"WHERE id=#{id}")
|
||||
int online(@Param("id") int id);
|
||||
|
||||
@Update("UPDATE wvp_stream_proxy " +
|
||||
"SET pulling=false " +
|
||||
"WHERE id=#{id}")
|
||||
int offline(@Param("id") int id);
|
||||
|
||||
@SelectProvider(type = StreamProxyProvider.class, method = "select")
|
||||
StreamProxy select(@Param("id") int id);
|
||||
|
||||
@Update("UPDATE wvp_stream_proxy " +
|
||||
" SET pulling=false, media_server_id = null," +
|
||||
" stream_key = null " +
|
||||
" WHERE id=#{id}")
|
||||
void removeStream(@Param("id")int id);
|
||||
void removeStream(@Param("id") int id);
|
||||
|
||||
@Update("UPDATE wvp_stream_proxy " +
|
||||
" SET pulling=#{pulling}, media_server_id = #{mediaServerId}, " +
|
||||
" stream_key = #{streamKey} " +
|
||||
" WHERE id=#{id}")
|
||||
void addStream(StreamProxy streamProxy);
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package com.genersoft.iot.vmp.streamProxy.dao.provider;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class StreamProxyProvider {
|
||||
|
||||
public String getBaseSelectSql(){
|
||||
return "SELECT " +
|
||||
" st.*, " +
|
||||
ChannelDataType.STREAM_PROXY.value + " as data_type, " +
|
||||
" st.id as data_device_id, " +
|
||||
" wdc.*, " +
|
||||
" wdc.id as gb_id" +
|
||||
" FROM wvp_stream_proxy st " +
|
||||
" LEFT join wvp_device_channel wdc " +
|
||||
" on wdc.data_type = 3 and st.id = wdc.data_device_id ";
|
||||
}
|
||||
|
||||
public String select(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + " WHERE st.id = " + params.get("id");
|
||||
}
|
||||
|
||||
public String selectForPushingInMediaServer(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + " WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc";
|
||||
}
|
||||
|
||||
public String selectOneByAppAndStream(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + String.format(" WHERE st.app='%s' AND st.stream='%s' order by st.create_time desc",
|
||||
params.get("app"), params.get("stream"));
|
||||
}
|
||||
|
||||
public String selectAll(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append(" WHERE 1=1 ");
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND ")
|
||||
.append(" (")
|
||||
.append(" st.app LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" OR")
|
||||
.append(" st.stream LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" OR")
|
||||
.append(" wdc.gb_device_id LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" OR")
|
||||
.append(" wdc.gb_name LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
|
||||
.append(" )")
|
||||
;
|
||||
}
|
||||
Object pulling = params.get("pulling");
|
||||
if (pulling != null) {
|
||||
if ((Boolean) pulling) {
|
||||
sqlBuild.append(" AND st.pulling=1 ");
|
||||
}else {
|
||||
sqlBuild.append(" AND st.pulling=0 ");
|
||||
}
|
||||
}
|
||||
if (params.get("mediaServerId") != null) {
|
||||
sqlBuild.append(" AND st.media_server_id='").append(params.get("mediaServerId")).append("'");
|
||||
}
|
||||
sqlBuild.append(" order by st.create_time desc");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
package com.genersoft.iot.vmp.streamPush.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,145 +19,45 @@ public interface StreamPushMapper {
|
|||
|
||||
Integer dataType = ChannelDataType.GB28181.value;
|
||||
|
||||
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) VALUES" +
|
||||
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime} ,#{updateTime}, #{createTime}, #{pushing}, #{startOfflinePush})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(StreamPush streamPushItem);
|
||||
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_stream_push " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
"<if test=\"app != null\">, app=#{app}</if>" +
|
||||
"<if test=\"stream != null\">, stream=#{stream}</if>" +
|
||||
"<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
|
||||
"<if test=\"serverId != null\">, server_id=#{serverId}</if>" +
|
||||
"<if test=\"pushTime != null\">, push_time=#{pushTime}</if>" +
|
||||
"<if test=\"pushing != null\">, pushing=#{pushing}</if>" +
|
||||
"<if test=\"startOfflinePush != null\">, start_offline_push=#{startOfflinePush}</if>" +
|
||||
"WHERE id = #{id}"+
|
||||
" </script>"})
|
||||
int update(StreamPush streamPushItem);
|
||||
|
||||
@Delete("DELETE FROM wvp_stream_push WHERE id=#{id}")
|
||||
int del(@Param("id") int id);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" SELECT " +
|
||||
" st.*, " +
|
||||
" st.id as data_device_id, " +
|
||||
" wdc.*, " +
|
||||
" wdc.id as gb_id" +
|
||||
" from " +
|
||||
" wvp_stream_push st " +
|
||||
" LEFT join wvp_device_channel wdc " +
|
||||
" on wdc.data_type = 2 and st.id = wdc.data_device_id " +
|
||||
" WHERE " +
|
||||
" 1=1 " +
|
||||
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " +
|
||||
" OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')</if> " +
|
||||
" <if test='pushing == true' > AND st.pushing=1</if>" +
|
||||
" <if test='pushing == false' > AND st.pushing=0 </if>" +
|
||||
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
|
||||
" order by st.create_time desc" +
|
||||
" </script>"})
|
||||
List<StreamPush> selectAll(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
|
||||
|
||||
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.app=#{app} AND st.stream=#{stream}")
|
||||
StreamPush selectByAppAndStream(@Param("app") String app, @Param("stream") String stream);
|
||||
|
||||
@Insert("<script>" +
|
||||
"Insert INTO wvp_stream_push ( " +
|
||||
" app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) " +
|
||||
" VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
|
||||
" ( #{item.app}, #{item.stream}, #{item.mediaServerId},#{item.serverId} ,#{item.pushTime}, #{item.updateTime}, #{item.createTime}, #{item.pushing}, #{item.startOfflinePush} )" +
|
||||
" </foreach>" +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int addAll(List<StreamPush> streamPushItems);
|
||||
|
||||
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId}")
|
||||
List<StreamPush> selectAllByMediaServerId(String mediaServerId);
|
||||
|
||||
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId} and wdc.gb_device_id is null")
|
||||
List<StreamPush> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
|
||||
|
||||
@Update("UPDATE wvp_stream_push " +
|
||||
"SET pushing=#{pushing} " +
|
||||
"WHERE id=#{id}")
|
||||
int updatePushStatus(@Param("id") int id, @Param("pushing") boolean pushing);
|
||||
|
||||
|
||||
@Select("<script> "+
|
||||
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
|
||||
"where (st.app, st.stream) in (" +
|
||||
"<foreach collection='offlineStreams' item='item' separator=','>" +
|
||||
"(#{item.app}, #{item.stream}) " +
|
||||
"</foreach>" +
|
||||
")</script>")
|
||||
List<StreamPush> getListFromRedis(List<StreamPushItemFromRedis> offlineStreams);
|
||||
|
||||
|
||||
@Select("SELECT CONCAT(app,stream) from wvp_stream_push")
|
||||
List<String> getAllAppAndStream();
|
||||
|
||||
@Select("select count(1) from wvp_stream_push ")
|
||||
int getAllCount();
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" select count(1) from wvp_stream_push where pushing = true" +
|
||||
" </script>"})
|
||||
int getAllPushing(Boolean usePushingAsStatus);
|
||||
|
||||
@MapKey("uniqueKey")
|
||||
@Select("SELECT CONCAT(wsp.app, wsp.stream) as unique_key, wsp.*, wsp.* , wdc.id as gb_id " +
|
||||
" from wvp_stream_push wsp " +
|
||||
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
|
||||
Map<String, StreamPush> getAllAppAndStreamMap();
|
||||
|
||||
|
||||
@MapKey("gbDeviceId")
|
||||
@Select("SELECT wdc.gb_device_id, wsp.id as data_device_id, wsp.*, wsp.* , wdc.id as gb_id " +
|
||||
" from wvp_stream_push wsp " +
|
||||
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
|
||||
Map<String, StreamPush> getAllGBId();
|
||||
|
||||
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.id=#{id}")
|
||||
StreamPush queryOne(@Param("id") int id);
|
||||
|
||||
@Select("<script> "+
|
||||
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
|
||||
" where st.id in (" +
|
||||
" <foreach collection='ids' item='item' separator=','>" +
|
||||
" #{item} " +
|
||||
" </foreach>" +
|
||||
" )</script>")
|
||||
List<StreamPush> selectInSet(Set<Integer> ids);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE FROM wvp_stream_push WHERE" +
|
||||
" id in (" +
|
||||
"<foreach collection='streamPushList' item='item' separator=','>" +
|
||||
" #{item.id} " +
|
||||
"</foreach>" +
|
||||
")</script>")
|
||||
void batchDel(List<StreamPush> streamPushList);
|
||||
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='streamPushItemForUpdate' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_stream_push" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
", app=#{item.app}" +
|
||||
", stream=#{item.stream}" +
|
||||
", media_server_id=#{item.mediaServerId}" +
|
||||
", server_id=#{item.serverId}" +
|
||||
", push_time=#{item.pushTime}" +
|
||||
", pushing=#{item.pushing}" +
|
||||
", start_offline_push=#{item.startOfflinePush}" +
|
||||
" WHERE id=#{item.id}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdate(List<StreamPush> streamPushItemForUpdate);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,739 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper">
|
||||
<sql id="BASE_SQL">
|
||||
SELECT id AS gb_id,
|
||||
data_type,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
record_plan_id,
|
||||
COALESCE(gb_device_id, device_id) AS gb_device_id,
|
||||
COALESCE(gb_name, NAME) AS gb_name,
|
||||
COALESCE(gb_manufacturer, manufacturer) AS gb_manufacturer,
|
||||
COALESCE(gb_model, model) AS gb_model,
|
||||
COALESCE(gb_owner, OWNER) AS gb_owner,
|
||||
COALESCE(gb_civil_code, civil_code) AS gb_civil_code,
|
||||
COALESCE(gb_block, block) AS gb_block,
|
||||
COALESCE(gb_address, address) AS gb_address,
|
||||
COALESCE(gb_parental, parental) AS gb_parental,
|
||||
COALESCE(gb_parent_id, parent_id) AS gb_parent_id,
|
||||
COALESCE(gb_safety_way, safety_way) AS gb_safety_way,
|
||||
COALESCE(gb_register_way, register_way) AS gb_register_way,
|
||||
COALESCE(gb_cert_num, cert_num) AS gb_cert_num,
|
||||
COALESCE(gb_certifiable, certifiable) AS gb_certifiable,
|
||||
COALESCE(gb_err_code, err_code) AS gb_err_code,
|
||||
COALESCE(gb_end_time, end_time) AS gb_end_time,
|
||||
COALESCE(gb_secrecy, secrecy) AS gb_secrecy,
|
||||
COALESCE(gb_ip_address, ip_address) AS gb_ip_address,
|
||||
COALESCE(gb_port, PORT) AS gb_port,
|
||||
COALESCE(gb_password, PASSWORD) AS gb_password,
|
||||
COALESCE(gb_status, STATUS) AS gb_status,
|
||||
COALESCE(gb_longitude, longitude) AS gb_longitude,
|
||||
COALESCE(gb_latitude, latitude) AS gb_latitude,
|
||||
COALESCE(gb_ptz_type, ptz_type) AS gb_ptz_type,
|
||||
COALESCE(gb_position_type, position_type) AS gb_position_type,
|
||||
COALESCE(gb_room_type, room_type) AS gb_room_type,
|
||||
COALESCE(gb_use_type, use_type) AS gb_use_type,
|
||||
COALESCE(gb_supply_light_type, supply_light_type) AS gb_supply_light_type,
|
||||
COALESCE(gb_direction_type, direction_type) AS gb_direction_type,
|
||||
COALESCE(gb_resolution, resolution) AS gb_resolution,
|
||||
COALESCE(gb_business_group_id, business_group_id) AS gb_business_group_id,
|
||||
COALESCE(gb_download_speed, download_speed) AS gb_download_speed,
|
||||
COALESCE(gb_svc_space_support_mod, svc_space_support_mod) AS gb_svc_space_support_mod,
|
||||
COALESCE(gb_svc_time_support_mode, svc_time_support_mode) AS gb_svc_time_support_mode
|
||||
FROM wvp_device_channel
|
||||
</sql>
|
||||
|
||||
<sql id="BASE_SQL_FOR_PLATFORM">
|
||||
select
|
||||
wdc.id as gb_id,
|
||||
wdc.data_type,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,
|
||||
coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,
|
||||
coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,
|
||||
coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,
|
||||
coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,
|
||||
coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,
|
||||
coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,
|
||||
coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,
|
||||
coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id
|
||||
</sql>
|
||||
|
||||
<select id="queryByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO wvp_device_channel
|
||||
(gb_device_id,
|
||||
data_type,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
gb_name,
|
||||
gb_manufacturer,
|
||||
gb_model,
|
||||
gb_owner,
|
||||
gb_civil_code,
|
||||
gb_block,
|
||||
gb_address,
|
||||
gb_parental,
|
||||
gb_parent_id,
|
||||
gb_safety_way,
|
||||
gb_register_way,
|
||||
gb_cert_num,
|
||||
gb_certifiable,
|
||||
gb_err_code,
|
||||
gb_end_time,
|
||||
gb_secrecy,
|
||||
gb_ip_address,
|
||||
gb_port,
|
||||
gb_password,
|
||||
gb_status,
|
||||
gb_longitude,
|
||||
gb_latitude,
|
||||
gb_ptz_type,
|
||||
gb_position_type,
|
||||
gb_room_type,
|
||||
gb_use_type,
|
||||
gb_supply_light_type,
|
||||
gb_direction_type,
|
||||
gb_resolution,
|
||||
gb_business_group_id,
|
||||
gb_download_speed,
|
||||
gb_svc_space_support_mod,
|
||||
gb_svc_time_support_mode)
|
||||
VALUES (#{gbDeviceId},
|
||||
#{dataType},
|
||||
#{dataDeviceId},
|
||||
#{createTime},
|
||||
#{updateTime},
|
||||
#{gbName},
|
||||
#{gbManufacturer},
|
||||
#{gbModel},
|
||||
#{gbOwner},
|
||||
#{gbCivilCode},
|
||||
#{gbBlock},
|
||||
#{gbAddress},
|
||||
#{gbParental},
|
||||
#{gbParentId},
|
||||
#{gbSafetyWay},
|
||||
#{gbRegisterWay},
|
||||
#{gbCertNum},
|
||||
#{gbCertifiable},
|
||||
#{gbErrCode},
|
||||
#{gbEndTime},
|
||||
#{gbSecrecy},
|
||||
#{gbIpAddress},
|
||||
#{gbPort},
|
||||
#{gbPassword},
|
||||
#{gbStatus},
|
||||
#{gbLongitude},
|
||||
#{gbLatitude},
|
||||
#{gbPtzType},
|
||||
#{gbPositionType},
|
||||
#{gbRoomType},
|
||||
#{gbUseType},
|
||||
#{gbSupplyLightType},
|
||||
#{gbDirectionType},
|
||||
#{gbResolution},
|
||||
#{gbBusinessGroupId},
|
||||
#{gbDownloadSpeed},
|
||||
#{gbSvcSpaceSupportMod},
|
||||
#{gbSvcTimeSupportMode})
|
||||
</insert>
|
||||
|
||||
<select id="queryById" parameterType="int" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and id = #{gbId}
|
||||
</select>
|
||||
|
||||
<delete id="delete">
|
||||
delete
|
||||
from wvp_device_channel
|
||||
where id = #{gbId}
|
||||
</delete>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_device_channel
|
||||
SET update_time=#{updateTime},
|
||||
gb_device_id = #{gbDeviceId},
|
||||
gb_name = #{gbName},
|
||||
gb_manufacturer = #{gbManufacturer},
|
||||
gb_model = #{gbModel},
|
||||
gb_owner = #{gbOwner},
|
||||
gb_civil_code = #{gbCivilCode},
|
||||
gb_block = #{gbBlock},
|
||||
gb_address = #{gbAddress},
|
||||
gb_parental = #{gbParental},
|
||||
gb_parent_id = #{gbParentId},
|
||||
gb_safety_way = #{gbSafetyWay},
|
||||
gb_register_way = #{gbRegisterWay},
|
||||
gb_cert_num = #{gbCertNum},
|
||||
gb_certifiable = #{gbCertifiable},
|
||||
gb_err_code = #{gbErrCode},
|
||||
gb_end_time = #{gbEndTime},
|
||||
gb_ip_address = #{gbIpAddress},
|
||||
gb_port = #{gbPort},
|
||||
gb_password = #{gbPassword},
|
||||
gb_status = #{gbStatus},
|
||||
gb_longitude = #{gbLongitude},
|
||||
gb_latitude = #{gbLatitude},
|
||||
gb_ptz_type = #{gbPtzType},
|
||||
gb_position_type = #{gbPositionType},
|
||||
gb_room_type = #{gbRoomType},
|
||||
gb_use_type = #{gbUseType},
|
||||
gb_supply_light_type = #{gbSupplyLightType},
|
||||
gb_direction_type = #{gbDirectionType},
|
||||
gb_resolution = #{gbResolution},
|
||||
gb_business_group_id = #{gbBusinessGroupId},
|
||||
gb_download_speed = #{gbDownloadSpeed},
|
||||
gb_svc_space_support_mod = #{gbSvcSpaceSupportMod},
|
||||
gb_svc_time_support_mode = #{gbSvcTimeSupportMode}
|
||||
WHERE id = #{gbId}
|
||||
</update>
|
||||
|
||||
<update id="updateStatusById">
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_status = #{status}
|
||||
WHERE id = #{gbId}
|
||||
</update>
|
||||
|
||||
<update id="updateStatusForListById">
|
||||
<foreach collection='commonGBChannels' index='index' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel SET gb_status = #{status} WHERE id = #{item.gbId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryInListByStatus" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and gb_status=#{status} and id in
|
||||
<foreach collection="commonGBChannelList" item="item" open="(" close=")" separator=",">
|
||||
#{item.gbId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="batchAdd">
|
||||
INSERT INTO wvp_device_channel (
|
||||
gb_device_id,
|
||||
data_type,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
gb_name,
|
||||
gb_manufacturer,
|
||||
gb_model,
|
||||
gb_owner,
|
||||
gb_civil_code,
|
||||
gb_block,
|
||||
gb_address,
|
||||
gb_parental,
|
||||
gb_parent_id ,
|
||||
gb_safety_way,
|
||||
gb_register_way,
|
||||
gb_cert_num,
|
||||
gb_certifiable,
|
||||
gb_err_code,
|
||||
gb_end_time,
|
||||
gb_secrecy,
|
||||
gb_ip_address,
|
||||
gb_port,
|
||||
gb_password,
|
||||
gb_status,
|
||||
gb_longitude,
|
||||
gb_latitude,
|
||||
gb_ptz_type,
|
||||
gb_position_type,
|
||||
gb_room_type,
|
||||
gb_use_type,
|
||||
gb_supply_light_type,
|
||||
gb_direction_type,
|
||||
gb_resolution,
|
||||
gb_business_group_id,
|
||||
gb_download_speed,
|
||||
gb_svc_space_support_mod,
|
||||
gb_svc_time_support_mode)
|
||||
VALUES
|
||||
<foreach collection='commonGBChannels' index='index' item='item' separator=','>
|
||||
(#{item.gbDeviceId}, #{item.dataType}, #{item.dataDeviceId},#{item.createTime},#{item.updateTime},
|
||||
#{item.gbName},#{item.gbManufacturer}, #{item.gbModel},
|
||||
#{item.gbOwner},#{item.gbCivilCode},#{item.gbBlock}, #{item.gbAddress}, #{item.gbParental},
|
||||
#{item.gbParentId},#{item.gbSafetyWay},
|
||||
#{item.gbRegisterWay},#{item.gbCertNum},#{item.gbCertifiable},#{item.gbErrCode},#{item.gbEndTime},
|
||||
#{item.gbSecrecy},#{item.gbIpAddress},
|
||||
#{item.gbPort},#{item.gbPassword},#{item.gbStatus},#{item.gbLongitude},
|
||||
#{item.gbLatitude},#{item.gbPtzType},#{item.gbPositionType},#{item.gbRoomType},
|
||||
#{item.gbUseType},#{item.gbSupplyLightType},#{item.gbDirectionType},#{item.gbResolution},#{item.gbBusinessGroupId},#{item.gbDownloadSpeed},
|
||||
#{item.gbSvcSpaceSupportMod},#{item.gbSvcTimeSupportMode})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateStatus">
|
||||
<foreach collection='commonGBChannels' index='index' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel SET gb_status = #{item.gbStatus} WHERE id = #{item.gbId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="reset">
|
||||
UPDATE wvp_device_channel
|
||||
SET update_time=#{updateTime},
|
||||
gb_device_id = null,
|
||||
gb_name = null,
|
||||
gb_manufacturer = null,
|
||||
gb_model = null,
|
||||
gb_owner = null,
|
||||
gb_block = null,
|
||||
gb_address = null,
|
||||
gb_parental = null,
|
||||
gb_parent_id = null,
|
||||
gb_safety_way = null,
|
||||
gb_register_way = null,
|
||||
gb_cert_num = null,
|
||||
gb_certifiable = null,
|
||||
gb_err_code = null,
|
||||
gb_end_time = null,
|
||||
gb_secrecy = null,
|
||||
gb_ip_address = null,
|
||||
gb_port = null,
|
||||
gb_password = null,
|
||||
gb_status = null,
|
||||
gb_longitude = null,
|
||||
gb_latitude = null,
|
||||
gb_ptz_type = null,
|
||||
gb_position_type = null,
|
||||
gb_room_type = null,
|
||||
gb_use_type = null,
|
||||
gb_supply_light_type = null,
|
||||
gb_direction_type = null,
|
||||
gb_resolution = null,
|
||||
gb_business_group_id = null,
|
||||
gb_download_speed = null,
|
||||
gb_svc_space_support_mod = null,
|
||||
gb_svc_time_support_mode = null
|
||||
WHERE id = #{id}
|
||||
and data_type = #{dataType}
|
||||
and data_device_id = #{dataDeviceId}
|
||||
</update>
|
||||
|
||||
<select id="queryByIds" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and id in
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="batchDelete">
|
||||
delete from wvp_device_channel
|
||||
where id in
|
||||
<foreach collection='channelListInDb' item='item' open='(' separator=',' close=')'>
|
||||
#{item.gbId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryListByCivilCode" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
<where>
|
||||
channel_type = 0
|
||||
<if test="query != null">
|
||||
AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'
|
||||
OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )
|
||||
</if>
|
||||
<if test="online != null and online == 1">
|
||||
AND coalesce(gb_status, status) = 'ON'
|
||||
</if>
|
||||
<if test="online != null and online != 1">
|
||||
AND coalesce(gb_status, status) = 'OFF'
|
||||
</if>
|
||||
<choose>
|
||||
<when test="civilCode != null">
|
||||
AND coalesce(gb_civil_code, civil_code) = #{civilCode}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND coalesce(gb_civil_code, civil_code) is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="dataType != null">
|
||||
AND data_type = #{dataType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryListByParentId" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
<where>
|
||||
channel_type = 0
|
||||
<if test="query != null">
|
||||
AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'
|
||||
OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )
|
||||
</if>
|
||||
<if test="online != null and online == 1">
|
||||
AND coalesce(gb_status, status) = 'ON'
|
||||
</if>
|
||||
<if test="online != null and online != 1">
|
||||
AND coalesce(gb_status, status) = 'OFF'
|
||||
</if>
|
||||
<choose>
|
||||
<when test="groupDeviceId != null">
|
||||
AND coalesce(gb_parent_id, parent_id) = #{groupDeviceId}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND coalesce(gb_parent_id, parent_id) is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="dataType != null">
|
||||
AND data_type = #{dataType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryForRegionTreeByCivilCode" resultType="com.genersoft.iot.vmp.gb28181.bean.RegionTree">
|
||||
select id,
|
||||
concat('channel', id) as tree_id,
|
||||
coalesce(gb_device_id, device_id) as device_id,
|
||||
coalesce(gb_name, name) as name,
|
||||
coalesce(gb_parent_id, parent_id) as parent_device_id,
|
||||
coalesce(gb_status, status) as status,
|
||||
1 as type,
|
||||
true as is_leaf
|
||||
from wvp_device_channel
|
||||
where coalesce(gb_civil_code, civil_code) = #{parentDeviceId}
|
||||
<if test='query != null'>
|
||||
AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')
|
||||
OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="removeCivilCode">
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_civil_code = null, civil_code = null
|
||||
WHERE gb_civil_code in
|
||||
<foreach collection='allChildren' item='item' open='(' separator=',' close=')'>#{item.deviceId}</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateRegion">
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_civil_code = #{civilCode}
|
||||
WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryByIdsOrCivilCode" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
<where>
|
||||
channel_type = 0
|
||||
<if test="civilCode != null">
|
||||
AND coalesce(gb_civil_code, civil_code) = #{civilCode}
|
||||
</if>
|
||||
<if test="ids != null">
|
||||
OR id in
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="removeCivilCodeByChannels">
|
||||
UPDATE wvp_device_channel SET gb_civil_code = null, civil_code = null WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryByCivilCode" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and coalesce(gb_civil_code, civil_code) = #{civilCode}
|
||||
</select>
|
||||
|
||||
<select id="queryByGbDeviceIds" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and data_type = #{dataType} and data_device_id in
|
||||
<foreach collection="deviceIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryByGbDeviceIdsForIds" resultType="java.lang.Integer">
|
||||
select id from wvp_device_channel
|
||||
where channel_type = 0 and data_type = #{dataType} and data_device_id in
|
||||
<foreach collection='deviceIds' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryByGroupList" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and gb_parent_id in
|
||||
<foreach collection="groupList" item="item" open="(" close=")" separator=",">
|
||||
#{item.deviceId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="removeParentIdByChannels">
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null
|
||||
WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryByBusinessGroup" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and coalesce(gb_business_group_id, business_group_id) = #{businessGroup}
|
||||
</select>
|
||||
|
||||
<select id="queryByParentId" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and gb_parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<update id="updateBusinessGroupByChannelList">
|
||||
UPDATE wvp_device_channel SET gb_business_group_id = #{businessGroup} WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentIdByChannelList">
|
||||
UPDATE wvp_device_channel SET gb_parent_id = #{parentId} WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryForGroupTreeByParentId" resultType="com.genersoft.iot.vmp.gb28181.bean.GroupTree">
|
||||
select
|
||||
id,
|
||||
concat('channel', id) as tree_id,
|
||||
coalesce(gb_device_id, device_id) as device_id,
|
||||
coalesce(gb_name, name) as name,
|
||||
coalesce(gb_parent_id, parent_id) as parent_device_id,
|
||||
coalesce(gb_business_group_id, business_group_id) as business_group,
|
||||
coalesce(gb_status, status) as status,
|
||||
1 as type,
|
||||
true as is_leaf
|
||||
from wvp_device_channel
|
||||
where channel_type = 0 and coalesce(gb_parent_id, parent_id) = #{parent}
|
||||
<if test='query != null'>
|
||||
AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')
|
||||
OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateGroup">
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}
|
||||
WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="batchUpdate">
|
||||
<foreach collection='commonGBChannels' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel
|
||||
SET update_time=#{item.updateTime},
|
||||
gb_device_id=#{item.gbDeviceId},
|
||||
gb_name=#{item.gbName},
|
||||
gb_manufacturer=#{item.gbManufacturer},
|
||||
gb_model=#{item.gbModel},
|
||||
gb_owner=#{item.gbOwner},
|
||||
gb_civil_code=#{item.gbCivilCode},
|
||||
gb_block=#{item.gbBlock},
|
||||
gb_address=#{item.gbAddress},
|
||||
gb_parental=#{item.gbParental},
|
||||
gb_safety_way=#{item.gbSafetyWay},
|
||||
gb_register_way=#{item.gbRegisterWay},
|
||||
gb_cert_num=#{item.gbCertNum},
|
||||
gb_certifiable=#{item.gbCertifiable},
|
||||
gb_err_code=#{item.gbErrCode},
|
||||
gb_end_time=#{item.gbEndTime},
|
||||
gb_ip_address=#{item.gbIpAddress},
|
||||
gb_port=#{item.gbPort},
|
||||
gb_password=#{item.gbPassword},
|
||||
gb_status=#{item.gbStatus},
|
||||
gb_longitude=#{item.gbLongitude},
|
||||
gb_latitude=#{item.gbLatitude},
|
||||
gb_ptz_type=#{item.gbPtzType},
|
||||
gb_position_type=#{item.gbPositionType},
|
||||
gb_room_type=#{item.gbRoomType},
|
||||
gb_use_type=#{item.gbUseType},
|
||||
gb_supply_light_type=#{item.gbSupplyLightType},
|
||||
gb_direction_type=#{item.gbDirectionType},
|
||||
gb_resolution=#{item.gbResolution},
|
||||
gb_business_group_id=#{item.gbBusinessGroupId},
|
||||
gb_download_speed=#{item.gbDownloadSpeed},
|
||||
gb_svc_space_support_mod=#{item.gbSvcSpaceSupportMod},
|
||||
gb_svc_time_support_mode=#{item.gbSvcTimeSupportMode}
|
||||
WHERE id=#{item.gbId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryWithPlatform" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL_FOR_PLATFORM"/>
|
||||
where wpgc.platform_id = #{platformId}
|
||||
</select>
|
||||
|
||||
<select id="queryShareChannelByParentId" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL_FOR_PLATFORM"/>
|
||||
where wpgc.platform_id = #{platformId}
|
||||
and coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="queryShareChannelByCivilCode" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL_FOR_PLATFORM"/>
|
||||
where wpgc.platform_id = #{platformId}
|
||||
and coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) = #{civilCode}
|
||||
</select>
|
||||
|
||||
<update id="updateCivilCodeByChannelList">
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_civil_code = #{civilCode}
|
||||
WHERE id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryListByStreamPushList" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and data_type = #{dataType} and data_device_id in
|
||||
<foreach collection="streamPushList" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateGpsByDeviceIdForStreamPush">
|
||||
<foreach collection='channels' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel
|
||||
SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude}
|
||||
WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryList" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0
|
||||
<if test="query != null">
|
||||
AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'
|
||||
OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )
|
||||
</if>
|
||||
<if test="online != null and online == 1">
|
||||
AND coalesce(gb_status, status) = 'ON'
|
||||
</if>
|
||||
<if test="online != null and online != 1">
|
||||
AND coalesce(gb_status, status) = 'OFF'
|
||||
</if>
|
||||
<if test="hasRecordPlan != null and hasRecordPlan == 1">
|
||||
AND record_plan_id > 0
|
||||
</if>
|
||||
<if test="dataType != null">
|
||||
AND data_type = #{dataType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="removeRecordPlan">
|
||||
UPDATE wvp_device_channel
|
||||
SET record_plan_id = null
|
||||
WHERE id in
|
||||
<foreach collection='channelIds' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</update>
|
||||
|
||||
<insert id="addRecordPlan">
|
||||
UPDATE wvp_device_channel
|
||||
SET record_plan_id = #{planId}
|
||||
WHERE id in
|
||||
<foreach collection='channelIds' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="addRecordPlanForAll">
|
||||
UPDATE wvp_device_channel
|
||||
SET record_plan_id = #{planId}
|
||||
</insert>
|
||||
|
||||
<delete id="removeRecordPlanByPlanId">
|
||||
UPDATE wvp_device_channel
|
||||
SET record_plan_id = null
|
||||
WHERE record_plan_id = #{planId}
|
||||
</delete>
|
||||
|
||||
<select id="queryForRecordPlanForWebList" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
select
|
||||
wdc.id as gb_id,
|
||||
wdc.data_type,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
wdc.record_plan_id,
|
||||
coalesce( wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce( wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce( wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce( wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce( wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce( wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce( wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce( wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce( wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce( wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce( wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce( wdc.gb_register_way, wdc.register_way) as gb_register_way,
|
||||
coalesce( wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce( wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,
|
||||
coalesce( wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce( wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce( wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce( wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce( wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce( wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce( wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce( wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce( wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce( wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce( wdc.gb_position_type, wdc.position_type) as gb_position_type,
|
||||
coalesce( wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce( wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce( wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,
|
||||
coalesce( wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,
|
||||
coalesce( wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce( wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,
|
||||
coalesce( wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,
|
||||
coalesce( wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,
|
||||
coalesce( wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode
|
||||
from wvp_device_channel wdc
|
||||
where wdc.channel_type = 0
|
||||
<if test='query != null'>
|
||||
AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') escape '/'
|
||||
OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
<if test='online == true'>AND coalesce(wdc.gb_status, wdc.status) = 'ON'</if>
|
||||
<if test='online == false'>AND coalesce(wdc.gb_status, wdc.status) = 'OFF'</if>
|
||||
<if test='hasLink == true'>AND wdc.record_plan_id = #{planId}</if>
|
||||
<if test='hasLink == false'>AND wdc.record_plan_id is null</if>
|
||||
<if test='dataType != null'>AND wdc.data_type = #{dataType}</if>
|
||||
</select>
|
||||
|
||||
<select id="queryByDataId" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
<include refid="BASE_SQL"/>
|
||||
where channel_type = 0 and data_type = #{dataType} and data_device_id = #{dataDeviceId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,36 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.DeviceAlarmMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time,
|
||||
alarm_description, longitude, latitude, alarm_type, create_time)
|
||||
VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription},
|
||||
#{longitude}, #{latitude}, #{alarmType}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<select id="query" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm">
|
||||
SELECT * FROM wvp_device_alarm
|
||||
<where>
|
||||
<if test="deviceId != null">AND device_id = #{deviceId}</if>
|
||||
<if test="alarmPriority != null">AND alarm_priority = #{alarmPriority}</if>
|
||||
<if test="alarmMethod != null">AND alarm_method = #{alarmMethod}</if>
|
||||
<if test="alarmType != null">AND alarm_type = #{alarmType}</if>
|
||||
<if test="startTime != null">AND alarm_time >= #{startTime}</if>
|
||||
<if test="endTime != null">AND alarm_time <= #{endTime}</if>
|
||||
</where>
|
||||
ORDER BY alarm_time ASC
|
||||
</select>
|
||||
|
||||
<delete id="clearAlarmBeforeTime">
|
||||
DELETE FROM wvp_device_alarm
|
||||
<where>
|
||||
<if test="deviceIdList != null and id == null ">
|
||||
AND device_id in
|
||||
<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</if>
|
||||
<if test="time != null and id == null ">AND alarm_time <= #{time}</if>
|
||||
<if test="id != null">AND id = #{id}</if>
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,786 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper">
|
||||
<sql id="BASE_SELECT_SQL">
|
||||
SELECT dc.id,
|
||||
dc.data_device_id,
|
||||
dc.create_time,
|
||||
dc.update_time,
|
||||
dc.sub_count,
|
||||
dc.stream_id,
|
||||
dc.has_audio,
|
||||
dc.gps_time,
|
||||
dc.stream_identification,
|
||||
dc.channel_type,
|
||||
coalesce(dc.gb_device_id, dc.device_id) as device_id,
|
||||
coalesce(dc.gb_name, dc.name) as name,
|
||||
coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,
|
||||
coalesce(dc.gb_model, dc.model) as model,
|
||||
coalesce(dc.gb_owner, dc.owner) as owner,
|
||||
coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,
|
||||
coalesce(dc.gb_block, dc.block) as block,
|
||||
coalesce(dc.gb_address, dc.address) as address,
|
||||
coalesce(dc.gb_parental, dc.parental) as parental,
|
||||
coalesce(dc.gb_parent_id, dc.parent_id) as parent_id,
|
||||
coalesce(dc.gb_safety_way, dc.safety_way) as safety_way,
|
||||
coalesce(dc.gb_register_way, dc.register_way) as register_way,
|
||||
coalesce(dc.gb_cert_num, dc.cert_num) as cert_num,
|
||||
coalesce(dc.gb_certifiable, dc.certifiable) as certifiable,
|
||||
coalesce(dc.gb_err_code, dc.err_code) as err_code,
|
||||
coalesce(dc.gb_end_time, dc.end_time) as end_time,
|
||||
coalesce(dc.gb_secrecy, dc.secrecy) as secrecy,
|
||||
coalesce(dc.gb_ip_address, dc.ip_address) as ip_address,
|
||||
coalesce(dc.gb_port, dc.port) as port,
|
||||
coalesce(dc.gb_password, dc.password) as password,
|
||||
coalesce(dc.gb_status, dc.status) as status,
|
||||
coalesce(dc.gb_longitude, dc.longitude) as longitude,
|
||||
coalesce(dc.gb_latitude, dc.latitude) as latitude,
|
||||
coalesce(dc.gb_ptz_type, dc.ptz_type) as ptz_type,
|
||||
coalesce(dc.gb_position_type, dc.position_type) as position_type,
|
||||
coalesce(dc.gb_room_type, dc.room_type) as room_type,
|
||||
coalesce(dc.gb_use_type, dc.use_type) as use_type,
|
||||
coalesce(dc.gb_supply_light_type, dc.supply_light_type) as supply_light_type,
|
||||
coalesce(dc.gb_direction_type, dc.direction_type) as direction_type,
|
||||
coalesce(dc.gb_resolution, dc.resolution) as resolution,
|
||||
coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,
|
||||
coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,
|
||||
coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,
|
||||
coalesce(dc.gb_svc_time_support_mode, dc.svc_time_support_mode) as svc_time_support_mode
|
||||
from wvp_device_channel dc
|
||||
</sql>
|
||||
<insert id="add">
|
||||
insert into wvp_device_channel
|
||||
(device_id, data_type, data_device_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_count, stream_id, has_audio, gps_time,
|
||||
stream_identification, channel_type)
|
||||
values (#{deviceId}, #{dataType}, #{dataDeviceId}, #{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},
|
||||
#{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime},
|
||||
#{streamIdentification}, #{channelType})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_device_channel
|
||||
SET update_time=#{updateTime},
|
||||
device_id=#{deviceId},
|
||||
data_type=#{dataType},
|
||||
data_device_id=#{dataDeviceId},
|
||||
name=#{name},
|
||||
manufacturer=#{manufacturer},
|
||||
model=#{model},
|
||||
owner=#{owner},
|
||||
civil_code=#{civilCode},
|
||||
block=#{block},
|
||||
address=#{address},
|
||||
parental=#{parental},
|
||||
parent_id=#{parentId},
|
||||
safety_way=#{safetyWay},
|
||||
register_way=#{registerWay},
|
||||
cert_num=#{certNum},
|
||||
certifiable=#{certifiable},
|
||||
err_code=#{errCode},
|
||||
end_time=#{endTime},
|
||||
secrecy=#{secrecy},
|
||||
ip_address=#{ipAddress},
|
||||
port=#{port},
|
||||
password=#{password},
|
||||
status=#{status},
|
||||
longitude=#{longitude},
|
||||
latitude=#{latitude},
|
||||
ptz_type=#{ptzType},
|
||||
position_type=#{positionType},
|
||||
room_type=#{roomType},
|
||||
use_type=#{useType},
|
||||
supply_light_type=#{supplyLightType},
|
||||
direction_type=#{directionType},
|
||||
resolution=#{resolution},
|
||||
business_group_id=#{businessGroupId},
|
||||
download_speed=#{downloadSpeed},
|
||||
svc_space_support_mod=#{svcSpaceSupportMod},
|
||||
svc_time_support_mode=#{svcTimeSupportMode},
|
||||
sub_count=#{subCount},
|
||||
stream_id=#{streamId},
|
||||
has_audio=#{hasAudio},
|
||||
gps_time=#{gpsTime},
|
||||
stream_identification=#{streamIdentification},
|
||||
channel_type=#{channelType}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="queryChannels" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
<where>
|
||||
data_type = 1 and dc.data_device_id = #{dataDeviceId}
|
||||
<choose>
|
||||
<when test="businessGroupId != null">
|
||||
AND coalesce(dc.gb_business_group_id, dc.business_group_id)=#{businessGroupId} AND
|
||||
coalesce(dc.gb_parent_id, dc.parent_id) is null
|
||||
</when>
|
||||
<when test="parentChannelId != null">
|
||||
AND coalesce(dc.gb_parent_id, dc.parent_id)=#{parentChannelId}
|
||||
</when>
|
||||
<otherwise>
|
||||
equipmentcode,equipmenttypeid,x,y,equipmentsyscode
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="civilCode != null">
|
||||
AND (coalesce(dc.gb_civil_code, dc.civil_code) = #{civilCode}
|
||||
OR (LENGTH(coalesce(dc.gb_device_id, dc.device_id))=LENGTH(#{civilCode}) + 2)
|
||||
AND coalesce(dc.gb_device_id, dc.device_id) LIKE concat(#{civilCode},'%'))
|
||||
</if>
|
||||
<if test="query != null and query !='' ">
|
||||
AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') escape '/'
|
||||
OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
<!--todo-->
|
||||
<if test="online != null and online == '1'">
|
||||
AND coalesce(gb_status, status) = 'ON'
|
||||
</if>
|
||||
<if test="online != null and online !='1' ">
|
||||
AND coalesce(gb_status, status) = 'OFF'
|
||||
</if>
|
||||
<if test="hasSubChannel != null and hasSubChannel == '1'">
|
||||
AND dc.sub_count > 0
|
||||
</if>
|
||||
<if test="hasSubChannel != null and hasSubChannel !='1'">
|
||||
AND dc.sub_count = 0
|
||||
</if>
|
||||
<if test="channelIds != null and channelIds.size() > 0">
|
||||
AND dc.device_id in
|
||||
<foreach collection="channelIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryChannelsByDeviceDbId" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
where data_type = 1 and dc.data_device_id = #{dataDeviceId}
|
||||
</select>
|
||||
|
||||
<select id="queryChaneIdListByDeviceDbIds" resultType="java.lang.Integer">
|
||||
select id from wvp_device_channel where data_type =1 and data_device_id in
|
||||
<foreach item='item' index='index' collection='deviceDbIds' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="cleanChannelsByDeviceId">
|
||||
DELETE
|
||||
FROM wvp_device_channel
|
||||
WHERE data_type = 1
|
||||
and data_device_id = #{dataDeviceId}
|
||||
</delete>
|
||||
|
||||
<delete id="del">
|
||||
DELETE
|
||||
FROM wvp_device_channel
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryChannelsWithDeviceInfo" resultType="com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend">
|
||||
SELECT
|
||||
dc.id,
|
||||
dc.create_time,
|
||||
dc.update_time,
|
||||
dc.sub_count,
|
||||
coalesce(dc.gb_device_id, dc.device_id) as channel_id,
|
||||
de.device_id as device_id,
|
||||
coalesce(dc.gb_name, dc.name) as name,
|
||||
de.name as device_name,
|
||||
de.on_line as device_online,
|
||||
coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacture,
|
||||
coalesce(dc.gb_model, dc.model) as model,
|
||||
coalesce(dc.gb_owner, dc.owner) as owner,
|
||||
coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,
|
||||
coalesce(dc.gb_block, dc.block) as block,
|
||||
coalesce(dc.gb_address, dc.address) as address,
|
||||
coalesce(dc.gb_parental, dc.parental) as parental,
|
||||
coalesce(dc.gb_parent_id, dc.parent_id) as parent_id,
|
||||
coalesce(dc.gb_safety_way, dc.safety_way) as safety_way,
|
||||
coalesce(dc.gb_register_way, dc.register_way) as register_way,
|
||||
coalesce(dc.gb_cert_num, dc.cert_num) as cert_num,
|
||||
coalesce(dc.gb_certifiable, dc.certifiable) as certifiable,
|
||||
coalesce(dc.gb_err_code, dc.err_code) as err_code,
|
||||
coalesce(dc.gb_end_time, dc.end_time) as end_time,
|
||||
coalesce(dc.gb_secrecy, dc.secrecy) as secrecy,
|
||||
coalesce(dc.gb_ip_address, dc.ip_address) as ip_address,
|
||||
coalesce(dc.gb_port, dc.port) as port,
|
||||
coalesce(dc.gb_password, dc.password) as password,
|
||||
coalesce(dc.gb_ptz_type, dc.ptz_type) as ptz_type,
|
||||
coalesce(dc.gb_status, dc.status) as status,
|
||||
coalesce(dc.gb_longitude, dc.longitude) as longitude,
|
||||
coalesce(dc.gb_latitude, dc.latitude) as latitude,
|
||||
coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id
|
||||
from wvp_device_channel dc
|
||||
LEFT JOIN wvp_device de ON dc.data_device_id = de.id
|
||||
<where>
|
||||
dc.data_type = 1
|
||||
<if test='deviceId != null'>AND de.device_id = #{deviceId}</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='ON'</if>
|
||||
<if test='online == false'>AND dc.status='OFF'</if>
|
||||
<if test='hasSubChannel == true'>AND dc.sub_count > 0</if>
|
||||
<if test='hasSubChannel == false'>AND dc.sub_count = 0</if>
|
||||
<if test='channelIds != null'>
|
||||
AND dc.device_id in
|
||||
<foreach item='item' index='index' collection='channelIds'
|
||||
open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY dc.device_id ASC
|
||||
</select>
|
||||
|
||||
<update id="startPlay">
|
||||
UPDATE wvp_device_channel
|
||||
SET stream_id=#{streamId}
|
||||
WHERE id = #{channelId}
|
||||
</update>
|
||||
|
||||
<select id="queryChannelListInAll" resultType="com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce">
|
||||
SELECT
|
||||
dc.id,
|
||||
COALESCE(dc.gb_device_id, dc.device_id) AS name,
|
||||
COALESCE(dc.gb_name, dc.name) AS name,
|
||||
COALESCE(dc.gb_manufacturer, dc.manufacturer) AS manufacturer,
|
||||
COALESCE(dc.gb_ip_address, dc.ip_address) AS ip_address,
|
||||
dc.sub_count,
|
||||
pgc.platform_id as platform_id,
|
||||
pgc.catalog_id as catalog_id
|
||||
FROM wvp_device_channel dc
|
||||
LEFT JOIN wvp_device de ON dc.data_device_id = de.id
|
||||
LEFT JOIN wvp_platform_channel pgc on pgc.device_channel_id = dc.id
|
||||
WHERE dc.data_type = 1
|
||||
<if test='query != null'>
|
||||
AND (COALESCE(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%')
|
||||
OR COALESCE(dc.gb_name, dc.name) LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
<if test='online == true'>AND dc.status='ON'</if>
|
||||
<if test='online == false'>AND dc.status='OFF'</if>
|
||||
<if test='hasSubChannel!= null and hasSubChannel == true'>AND dc.sub_count > 0</if>
|
||||
<if test='hasSubChannel!= null and hasSubChannel == false'>AND dc.sub_count = 0</if>
|
||||
<if test='catalogId == null '>AND dc.id not in (select device_channel_id from wvp_platform_channel where
|
||||
platform_id=#{platformId})
|
||||
</if>
|
||||
<if test='catalogId != null '>AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId}</if>
|
||||
ORDER BY COALESCE(dc.gb_device_id, dc.device_id)
|
||||
</select>
|
||||
|
||||
<update id="offline">
|
||||
UPDATE wvp_device_channel
|
||||
SET status='OFF'
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="batchAdd">
|
||||
insert into wvp_device_channel
|
||||
(device_id, data_type, data_device_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_count, stream_id, has_audio, gps_time,
|
||||
stream_identification, channel_type)
|
||||
values
|
||||
<foreach collection='addChannels' index='index' item='item' separator=','>
|
||||
(#{item.deviceId}, #{item.dataType}, #{item.dataDeviceId}, #{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},
|
||||
#{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId},
|
||||
#{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}, #{item.channelType})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="online">
|
||||
UPDATE wvp_device_channel
|
||||
SET status='ON'
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdate">
|
||||
<foreach collection='updateChannels' item='item' separator=';'>
|
||||
UPDATE
|
||||
wvp_device_channel
|
||||
SET update_time=#{item.updateTime},
|
||||
device_id=#{item.deviceId},
|
||||
data_type=#{item.dataType},
|
||||
data_device_id=#{item.dataDeviceId},
|
||||
name=#{item.name},
|
||||
manufacturer=#{item.manufacturer},
|
||||
model=#{item.model},
|
||||
owner=#{item.owner},
|
||||
civil_code=#{item.civilCode},
|
||||
block=#{item.block},
|
||||
address=#{item.address},
|
||||
parental=#{item.parental},
|
||||
parent_id=#{item.parentId},
|
||||
safety_way=#{item.safetyWay},
|
||||
register_way=#{item.registerWay},
|
||||
cert_num=#{item.certNum},
|
||||
certifiable=#{item.certifiable},
|
||||
err_code=#{item.errCode},
|
||||
end_time=#{item.endTime},
|
||||
secrecy=#{item.secrecy},
|
||||
ip_address=#{item.ipAddress},
|
||||
port=#{item.port},
|
||||
password=#{item.password},
|
||||
status=#{item.status},
|
||||
longitude=#{item.longitude},
|
||||
latitude=#{item.latitude},
|
||||
ptz_type=#{item.ptzType},
|
||||
position_type=#{item.positionType},
|
||||
room_type=#{item.roomType},
|
||||
use_type=#{item.useType},
|
||||
supply_light_type=#{item.supplyLightType},
|
||||
direction_type=#{item.directionType},
|
||||
resolution=#{item.resolution},
|
||||
business_group_id=#{item.businessGroupId},
|
||||
download_speed=#{item.downloadSpeed},
|
||||
svc_space_support_mod=#{item.svcSpaceSupportMod},
|
||||
svc_time_support_mode=#{item.svcTimeSupportMode},
|
||||
sub_count=#{item.subCount},
|
||||
stream_id=#{item.streamId},
|
||||
has_audio=#{item.hasAudio},
|
||||
gps_time=#{item.gpsTime},
|
||||
stream_identification=#{item.streamIdentification},
|
||||
channel_type=#{item.channelType}
|
||||
WHERE id=#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="batchUpdateForNotify">
|
||||
<foreach collection='updateChannels' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel
|
||||
SET update_time=#{item.updateTime},
|
||||
device_id=#{item.deviceId},
|
||||
data_type=#{item.dataType},
|
||||
data_device_id=#{item.dataDeviceId},
|
||||
name=#{item.name},
|
||||
manufacturer=#{item.manufacturer},
|
||||
model=#{item.model},
|
||||
owner=#{item.owner},
|
||||
civil_code=#{item.civilCode},
|
||||
block=#{item.block},
|
||||
address=#{item.address},
|
||||
parental=#{item.parental},
|
||||
parent_id=#{item.parentId},
|
||||
safety_way=#{item.safetyWay},
|
||||
register_way=#{item.registerWay},
|
||||
cert_num=#{item.certNum},
|
||||
certifiable=#{item.certifiable},
|
||||
err_code=#{item.errCode},
|
||||
end_time=#{item.endTime},
|
||||
secrecy=#{item.secrecy},
|
||||
ip_address=#{item.ipAddress},
|
||||
port=#{item.port},
|
||||
password=#{item.password},
|
||||
status=#{item.status},
|
||||
longitude=#{item.longitude},
|
||||
latitude=#{item.latitude},
|
||||
ptz_type=#{item.ptzType},
|
||||
position_type=#{item.positionType},
|
||||
room_type=#{item.roomType},
|
||||
use_type=#{item.useType},
|
||||
supply_light_type=#{item.supplyLightType},
|
||||
direction_type=#{item.directionType},
|
||||
resolution=#{item.resolution},
|
||||
business_group_id=#{item.businessGroupId},
|
||||
download_speed=#{item.downloadSpeed},
|
||||
svc_space_support_mod=#{item.svcSpaceSupportMod},
|
||||
svc_time_support_mode=#{item.svcTimeSupportMode},
|
||||
sub_count=#{item.subCount},
|
||||
stream_id=#{item.streamId},
|
||||
has_audio=#{item.hasAudio},
|
||||
gps_time=#{item.gpsTime},
|
||||
stream_identification=#{item.streamIdentification},
|
||||
channel_type=#{item.channelType}
|
||||
WHERE data_type = #{item.dataType} and data_device_id = #{item.dataDeviceId} and device_id=#{item.deviceId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateChannelSubCount">
|
||||
update wvp_device_channel
|
||||
set sub_count =
|
||||
(select *
|
||||
from (select count(0)
|
||||
from wvp_device_channel
|
||||
where data_type = 1
|
||||
and data_device_id = #{dataDeviceId}
|
||||
and parent_id = #{channelId}) as temp)
|
||||
where data_type = 1
|
||||
and data_device_id = #{dataDeviceId}
|
||||
and device_id = #{channelId}
|
||||
</update>
|
||||
|
||||
<update id="updatePosition">
|
||||
UPDATE wvp_device_channel
|
||||
SET latitude=#{latitude},
|
||||
longitude=#{longitude},
|
||||
gps_time=#{gpsTime}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="queryAllChannelsForRefresh" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
select id,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
sub_count,
|
||||
stream_id,
|
||||
has_audio,
|
||||
gps_time,
|
||||
stream_identification,
|
||||
channel_type,
|
||||
device_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
|
||||
from wvp_device_channel
|
||||
where data_type = 1
|
||||
and data_device_id = #{dataDeviceId}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByChannelDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select de.*
|
||||
from wvp_device de
|
||||
left join wvp_device_channel dc on de.device_id = dc.device_id
|
||||
where dc.data_type = 1
|
||||
and dc.device_id = #{channelId}
|
||||
</select>
|
||||
|
||||
<delete id="batchDel">
|
||||
<foreach collection='deleteChannelList' item='item' separator=';'>
|
||||
DELETE FROM wvp_device_channel WHERE id=#{item.id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="batchUpdateStatus">
|
||||
<foreach collection='channels' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel SET status=#{item.status} WHERE data_type = #{item.dataType}
|
||||
and device_id=#{item.deviceId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getOnlineCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from wvp_device_channel
|
||||
where status = 'ON'
|
||||
</select>
|
||||
|
||||
<select id="getAllChannelCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from wvp_device_channel
|
||||
</select>
|
||||
|
||||
<update id="updateChannelStreamIdentification">
|
||||
UPDATE wvp_device_channel
|
||||
SET stream_identification=#{streamIdentification}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateAllChannelStreamIdentification">
|
||||
UPDATE wvp_device_channel
|
||||
SET stream_identification=#{streamIdentification}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdatePosition">
|
||||
<foreach collection='channelList' item='item' separator=';'>
|
||||
UPDATE
|
||||
wvp_device_channel
|
||||
SET update_time=#{item.updateTime}
|
||||
<if test='item.longitude != null'>, longitude=#{item.longitude}</if>
|
||||
<if test='item.latitude != null'>, latitude=#{item.latitude}</if>
|
||||
<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>
|
||||
<where>
|
||||
<if test='item.id > 0'>
|
||||
and id=#{item.id}
|
||||
</if>
|
||||
<if test='item.id == 0'>
|
||||
and data_type = #{item.dataType}
|
||||
and data_device_id=#{item.dataDeviceId}
|
||||
AND device_id=#{item.deviceId}
|
||||
</if>
|
||||
</where>
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getOne" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
where dc.id=#{id}
|
||||
</select>
|
||||
<select id="getOneForSource" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
SELECT id,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
sub_count,
|
||||
stream_id,
|
||||
has_audio,
|
||||
gps_time,
|
||||
stream_identification,
|
||||
channel_type,
|
||||
device_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
|
||||
from wvp_device_channel
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getOneByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
where data_type =1 and dc.data_device_id=#{dataDeviceId}
|
||||
and coalesce(dc.gb_device_id, dc.device_id) = #{channelId}
|
||||
</select>
|
||||
<select id="getOneByDeviceIdForSource" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
SELECT id,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
sub_count,
|
||||
stream_id,
|
||||
has_audio,
|
||||
gps_time,
|
||||
stream_identification,
|
||||
channel_type,
|
||||
device_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
|
||||
from wvp_device_channel
|
||||
where data_type = 1
|
||||
and data_device_id = #{dataDeviceId}
|
||||
and coalesce(gb_device_id, device_id) = #{channelId}
|
||||
</select>
|
||||
|
||||
<update id="stopPlayById">
|
||||
UPDATE wvp_device_channel
|
||||
SET stream_id=null
|
||||
WHERE id = #{channelId}
|
||||
</update>
|
||||
|
||||
<update id="changeAudio">
|
||||
UPDATE wvp_device_channel
|
||||
SET has_audio=#{audio}
|
||||
WHERE id = #{channelId}
|
||||
</update>
|
||||
|
||||
<update id="updateStreamGPS">
|
||||
<foreach collection='gpsMsgInfoList' index='index' item='item' separator=';'>
|
||||
UPDATE wvp_device_channel SET gb_longitude = #{item.lng}, gb_latitude=#{item.lat}
|
||||
WHERE id = #{item.channelId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateStatus">
|
||||
UPDATE wvp_device_channel
|
||||
SET status=#{status}
|
||||
WHERE data_type = #{dataType}
|
||||
and data_device_id = #{dataDeviceId}
|
||||
AND device_id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateChannelForNotify">
|
||||
UPDATE wvp_device_channel
|
||||
SET update_time=#{updateTime},
|
||||
device_id=#{deviceId},
|
||||
data_device_id=#{dataDeviceId},
|
||||
name=#{name},
|
||||
manufacturer=#{manufacturer},
|
||||
model=#{model},
|
||||
owner=#{owner},
|
||||
civil_code=#{civilCode},
|
||||
block=#{block},
|
||||
address=#{address},
|
||||
parental=#{parental},
|
||||
parent_id=#{parentId},
|
||||
safety_way=#{safetyWay},
|
||||
register_way=#{registerWay},
|
||||
cert_num=#{certNum},
|
||||
certifiable=#{certifiable},
|
||||
err_code=#{errCode},
|
||||
end_time=#{endTime},
|
||||
secrecy=#{secrecy},
|
||||
ip_address=#{ipAddress},
|
||||
port=#{port},
|
||||
password=#{password},
|
||||
status=#{status},
|
||||
longitude=#{longitude},
|
||||
latitude=#{latitude},
|
||||
ptz_type=#{ptzType},
|
||||
position_type=#{positionType},
|
||||
room_type=#{roomType},
|
||||
use_type=#{useType},
|
||||
supply_light_type=#{supplyLightType},
|
||||
direction_type=#{directionType},
|
||||
resolution=#{resolution},
|
||||
business_group_id=#{businessGroupId},
|
||||
download_speed=#{downloadSpeed},
|
||||
svc_space_support_mod=#{svcSpaceSupportMod},
|
||||
svc_time_support_mode=#{svcTimeSupportMode},
|
||||
sub_count=#{subCount},
|
||||
stream_id=#{streamId},
|
||||
has_audio=#{hasAudio},
|
||||
gps_time=#{gpsTime},
|
||||
stream_identification=#{streamIdentification},
|
||||
channel_type=#{channelType}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getOneBySourceChannelId" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
SELECT id,
|
||||
data_device_id,
|
||||
create_time,
|
||||
update_time,
|
||||
sub_count,
|
||||
stream_id,
|
||||
has_audio,
|
||||
gps_time,
|
||||
stream_identification,
|
||||
channel_type,
|
||||
device_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
|
||||
from wvp_device_channel
|
||||
where data_type = 1
|
||||
and data_device_id = #{dataDeviceId}
|
||||
and device_id = #{channelId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,365 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.DeviceMapper">
|
||||
|
||||
<select id="getDeviceByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
SELECT id,
|
||||
device_id,
|
||||
coalesce(custom_name, name) as name,
|
||||
password,
|
||||
manufacturer,
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
stream_mode,
|
||||
ip,
|
||||
sdp_ip,
|
||||
local_ip,
|
||||
port,
|
||||
host_address,
|
||||
expires,
|
||||
register_time,
|
||||
keepalive_time,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
subscribe_cycle_for_catalog,
|
||||
subscribe_cycle_for_mobile_position,
|
||||
mobile_position_submission_interval,
|
||||
subscribe_cycle_for_alarm,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
geo_coord_sys,
|
||||
on_line,
|
||||
media_server_id,
|
||||
broadcast_push_after_ack,
|
||||
(SELECT count(0)
|
||||
FROM wvp_device_channel dc
|
||||
WHERE dc.data_type = 1
|
||||
and dc.data_device_id = de.id) as channel_count
|
||||
FROM wvp_device de
|
||||
WHERE de.device_id = #{deviceId}
|
||||
</select>
|
||||
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_device
|
||||
(device_id,
|
||||
name,
|
||||
manufacturer,
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
stream_mode,
|
||||
media_server_id,
|
||||
ip,
|
||||
sdp_ip,
|
||||
local_ip,
|
||||
port,
|
||||
host_address,
|
||||
expires,
|
||||
register_time,
|
||||
keepalive_time,
|
||||
keepalive_interval_time,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
subscribe_cycle_for_catalog,
|
||||
subscribe_cycle_for_mobile_position,
|
||||
mobile_position_submission_interval,
|
||||
subscribe_cycle_for_alarm,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
broadcast_push_after_ack,
|
||||
geo_coord_sys,
|
||||
on_line)
|
||||
VALUES (#{deviceId}, #{name}, #{manufacturer}, #{model}, #{firmware}, #{transport}, #{streamMode},
|
||||
#{mediaServerId}, #{ip}, #{sdpIp}, #{localIp}, #{port}, #{hostAddress}, #{expires}, #{registerTime},
|
||||
#{keepaliveTime}, #{keepaliveIntervalTime}, #{createTime}, #{updateTime}, #{charset},
|
||||
#{subscribeCycleForCatalog}, #{subscribeCycleForMobilePosition}, #{mobilePositionSubmissionInterval},
|
||||
#{subscribeCycleForAlarm}, #{ssrcCheck}, #{asMessageChannel}, #{broadcastPushAfterAck}, #{geoCoordSys},
|
||||
#{onLine})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_device
|
||||
SET update_time=#{updateTime}
|
||||
<if test="name != null">, name=#{name}</if>
|
||||
<if test="manufacturer != null">, manufacturer=#{manufacturer}</if>
|
||||
<if test="model != null">, model=#{model}</if>
|
||||
<if test="firmware != null">, firmware=#{firmware}</if>
|
||||
<if test="transport != null">, transport=#{transport}</if>
|
||||
<if test="ip != null">, ip=#{ip}</if>
|
||||
<if test="localIp != null">, local_ip=#{localIp}</if>
|
||||
<if test="port != null">, port=#{port}</if>
|
||||
<if test="hostAddress != null">, host_address=#{hostAddress}</if>
|
||||
<if test="onLine != null">, on_line=#{onLine}</if>
|
||||
<if test="registerTime != null">, register_time=#{registerTime}</if>
|
||||
<if test="keepaliveTime != null">, keepalive_time=#{keepaliveTime}</if>
|
||||
<if test="keepaliveIntervalTime != null">, keepalive_interval_time=#{keepaliveIntervalTime}</if>
|
||||
<if test="expires != null">, expires=#{expires}</if>
|
||||
WHERE device_id=#{deviceId}
|
||||
</update>
|
||||
|
||||
<select id="getDevices" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
SELECT
|
||||
id,
|
||||
device_id,
|
||||
coalesce(custom_name, name) as name,
|
||||
password,
|
||||
manufacturer,
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
stream_mode,
|
||||
ip,
|
||||
sdp_ip,
|
||||
local_ip,
|
||||
port,
|
||||
host_address,
|
||||
expires,
|
||||
register_time,
|
||||
keepalive_time,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
subscribe_cycle_for_catalog,
|
||||
subscribe_cycle_for_mobile_position,
|
||||
mobile_position_submission_interval,
|
||||
subscribe_cycle_for_alarm,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
broadcast_push_after_ack,
|
||||
geo_coord_sys,
|
||||
on_line,
|
||||
media_server_id,
|
||||
(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as
|
||||
channel_count
|
||||
FROM wvp_device de
|
||||
<where>
|
||||
<if test='online != null'>de.on_line=${online}</if>
|
||||
</where>
|
||||
order by de.create_time desc
|
||||
</select>
|
||||
|
||||
<delete id="del">
|
||||
DELETE
|
||||
FROM wvp_device
|
||||
WHERE device_id = #{deviceId}
|
||||
</delete>
|
||||
|
||||
<select id="getOnlineDevices" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
SELECT id,
|
||||
device_id,
|
||||
coalesce(custom_name, name) as name,
|
||||
password,
|
||||
manufacturer,
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
stream_mode,
|
||||
ip,
|
||||
sdp_ip,
|
||||
local_ip,
|
||||
port,
|
||||
host_address,
|
||||
expires,
|
||||
register_time,
|
||||
keepalive_time,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
subscribe_cycle_for_catalog,
|
||||
subscribe_cycle_for_mobile_position,
|
||||
mobile_position_submission_interval,
|
||||
subscribe_cycle_for_alarm,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
broadcast_push_after_ack,
|
||||
geo_coord_sys,
|
||||
on_line
|
||||
FROM wvp_device
|
||||
WHERE on_line = true
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByHostAndPort" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
SELECT id,
|
||||
device_id,
|
||||
coalesce(custom_name, name) as name,
|
||||
password,
|
||||
manufacturer,
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
stream_mode,
|
||||
ip,
|
||||
sdp_ip,
|
||||
local_ip,
|
||||
port,
|
||||
host_address,
|
||||
expires,
|
||||
register_time,
|
||||
keepalive_time,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
subscribe_cycle_for_catalog,
|
||||
subscribe_cycle_for_mobile_position,
|
||||
mobile_position_submission_interval,
|
||||
subscribe_cycle_for_alarm,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
broadcast_push_after_ack,
|
||||
geo_coord_sys,
|
||||
on_line
|
||||
FROM wvp_device
|
||||
WHERE ip = #{host}
|
||||
AND port = #{port}
|
||||
</select>
|
||||
|
||||
<update id="updateCustom">
|
||||
UPDATE wvp_device
|
||||
SET update_time=#{updateTime},
|
||||
custom_name=#{name},
|
||||
password=#{password},
|
||||
stream_mode=#{streamMode},
|
||||
ip=#{ip},
|
||||
sdp_ip=#{sdpIp},
|
||||
port=#{port},
|
||||
charset=#{charset},
|
||||
ssrc_check=#{ssrcCheck},
|
||||
as_message_channel=#{asMessageChannel},
|
||||
broadcast_push_after_ack=#{broadcastPushAfterAck},
|
||||
geo_coord_sys=#{geoCoordSys},
|
||||
media_server_id=#{mediaServerId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="addCustomDevice">
|
||||
INSERT INTO wvp_device
|
||||
(device_id,
|
||||
custom_name,
|
||||
password,
|
||||
sdp_ip,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
broadcast_push_after_ack,
|
||||
geo_coord_sys,
|
||||
on_line,
|
||||
stream_mode,
|
||||
media_server_id)
|
||||
VALUES (#{deviceId},
|
||||
#{name},
|
||||
#{password},
|
||||
#{sdpIp},
|
||||
#{createTime},
|
||||
#{updateTime},
|
||||
#{charset},
|
||||
#{ssrcCheck},
|
||||
#{asMessageChannel},
|
||||
#{broadcastPushAfterAck},
|
||||
#{geoCoordSys},
|
||||
#{onLine},
|
||||
#{streamMode},
|
||||
#{mediaServerId})
|
||||
</insert>
|
||||
|
||||
<select id="getAll" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select *
|
||||
FROM wvp_device
|
||||
</select>
|
||||
|
||||
<select id="queryDeviceWithAsMessageChannel" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select *
|
||||
FROM wvp_device
|
||||
where as_message_channel = true
|
||||
</select>
|
||||
|
||||
<select id="getDeviceList" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
SELECT
|
||||
id,
|
||||
device_id,
|
||||
coalesce(custom_name, name) as name,
|
||||
password,
|
||||
manufacturer,
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
stream_mode,
|
||||
ip,
|
||||
sdp_ip,
|
||||
local_ip,
|
||||
port,
|
||||
host_address,
|
||||
expires,
|
||||
register_time,
|
||||
keepalive_time,
|
||||
create_time,
|
||||
update_time,
|
||||
charset,
|
||||
subscribe_cycle_for_catalog,
|
||||
subscribe_cycle_for_mobile_position,
|
||||
mobile_position_submission_interval,
|
||||
subscribe_cycle_for_alarm,
|
||||
ssrc_check,
|
||||
as_message_channel,
|
||||
broadcast_push_after_ack,
|
||||
geo_coord_sys,
|
||||
on_line,
|
||||
media_server_id,
|
||||
(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as
|
||||
channel_count
|
||||
FROM wvp_device de
|
||||
<where>
|
||||
<if test='status != null'>AND de.on_line=${status}</if>
|
||||
<if test='query != null'>AND (
|
||||
coalesce(custom_name, name) LIKE concat('%',#{query},'%') escape '/'
|
||||
OR device_id LIKE concat('%',#{query},'%') escape '/'
|
||||
OR ip LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getRawChannel" resultType="com.genersoft.iot.vmp.gb28181.bean.DeviceChannel">
|
||||
select *
|
||||
from wvp_device_channel
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="query" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select *
|
||||
from wvp_device
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByChannelId" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select wd.*
|
||||
from wvp_device wd
|
||||
left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id
|
||||
where wdc.id = #{channelId}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceBySourceChannelDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select wd.*
|
||||
from wvp_device wd
|
||||
left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id
|
||||
where wdc.device_id = #{channelDeviceId}
|
||||
</select>
|
||||
|
||||
<update id="updateSubscribeCatalog">
|
||||
UPDATE wvp_device
|
||||
SET subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateSubscribeMobilePosition">
|
||||
UPDATE wvp_device
|
||||
SET subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition},
|
||||
mobile_position_submission_interval=#{mobilePositionSubmissionInterval}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,43 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper">
|
||||
<insert id="insertNewPosition">
|
||||
INSERT INTO wvp_device_mobile_position
|
||||
(device_id, channel_id, device_name, time, longitude, latitude, altitude, speed, direction, report_source,
|
||||
create_time)
|
||||
VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed},
|
||||
#{direction}, #{reportSource}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<select id="queryPositionByDeviceIdAndTime" resultType="com.genersoft.iot.vmp.gb28181.bean.MobilePosition">
|
||||
SELECT * FROM wvp_device_mobile_position
|
||||
WHERE device_id = #{deviceId}
|
||||
<if test="channelId != null">and channel_id = #{channelId}</if>
|
||||
<if test="startTime != null">AND time>=#{startTime}</if>
|
||||
<if test="endTime != null">AND time<=#{endTime}</if>
|
||||
ORDER BY time
|
||||
</select>
|
||||
<select id="queryLatestPositionByDevice" resultType="com.genersoft.iot.vmp.gb28181.bean.MobilePosition">
|
||||
SELECT *
|
||||
FROM wvp_device_mobile_position
|
||||
WHERE device_id = #{deviceId}
|
||||
ORDER BY time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<delete id="clearMobilePositionsByDeviceId">
|
||||
DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchadd">
|
||||
<foreach collection='mobilePositions' index='index' item='item' separator=';'>
|
||||
insert into wvp_device_mobile_position
|
||||
(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,
|
||||
create_time)
|
||||
values
|
||||
(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude},
|
||||
#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction},
|
||||
#{item.reportSource}, #{item.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,275 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.GroupMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_common_group
|
||||
(device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code)
|
||||
VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime},
|
||||
#{civilCode})
|
||||
</insert>
|
||||
|
||||
<insert id="addBusinessGroup">
|
||||
INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time, civil_code)
|
||||
VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})
|
||||
</insert>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
FROM wvp_common_group
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_common_group
|
||||
SET update_time=#{updateTime},
|
||||
device_id=#{deviceId},
|
||||
name=#{name},
|
||||
parent_id=#{parentId},
|
||||
parent_device_id=#{parentDeviceId},
|
||||
business_group=#{businessGroup},
|
||||
civil_code=#{civilCode}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="query" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group
|
||||
<where>
|
||||
<if test='query != null'>
|
||||
AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
<if test='parentId != null and businessGroupId != null '>
|
||||
AND parent_device_id = #{parentId} AND business_group=#{businessGroup}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="getChildren" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT *
|
||||
from wvp_common_group
|
||||
WHERE parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="queryOne" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT *
|
||||
from wvp_common_group
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="batchAdd">
|
||||
INSERT INTO wvp_common_group (
|
||||
device_id,
|
||||
name,
|
||||
parent_device_id,
|
||||
parent_id,
|
||||
business_group,
|
||||
create_time,
|
||||
civil_code,
|
||||
update_time)
|
||||
VALUES
|
||||
<foreach collection='groupList' index='index' item='item' separator=','>
|
||||
(#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId},
|
||||
#{item.businessGroup},#{item.createTime},#{item.civilCode},#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="queryForTree" resultType="com.genersoft.iot.vmp.gb28181.bean.GroupTree">
|
||||
SELECT *,
|
||||
concat('group', id) as tree_id,
|
||||
0 as type,
|
||||
false as is_leaf,
|
||||
'ON' as status
|
||||
from wvp_common_group
|
||||
<where>
|
||||
<if test='parentId != null'>and parent_id = #{parentId}</if>
|
||||
<if test='parentId == null'>and parent_id is null</if>
|
||||
<if test='query != null'>
|
||||
AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryForTreeByBusinessGroup" resultType="com.genersoft.iot.vmp.gb28181.bean.GroupTree">
|
||||
SELECT *, 0 as type, false as is_leaf
|
||||
from wvp_common_group
|
||||
where parent_id is not null and business_group = #{businessGroup} and device_id != #{businessGroup}
|
||||
<if test='query != null'>
|
||||
AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryBusinessGroupForTree" resultType="com.genersoft.iot.vmp.gb28181.bean.GroupTree">
|
||||
SELECT *, 0 as type, false as is_leaf
|
||||
from wvp_common_group
|
||||
where device_id=business_group
|
||||
<if test='query != null'>
|
||||
AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryOneByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT *
|
||||
from wvp_common_group
|
||||
WHERE device_id = #{deviceId}
|
||||
and business_group = #{businessGroup}
|
||||
</select>
|
||||
|
||||
<delete id="batchDelete">
|
||||
DELETE FROM wvp_common_group WHERE id in
|
||||
<foreach collection='allChildren' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryBusinessGroup" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT *
|
||||
from wvp_common_group
|
||||
WHERE device_id = #{businessGroup}
|
||||
and business_group = #{businessGroup}
|
||||
</select>
|
||||
|
||||
<select id="queryByBusinessGroup" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT *
|
||||
from wvp_common_group
|
||||
WHERE business_group = #{businessGroup}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByBusinessGroup">
|
||||
DELETE
|
||||
FROM wvp_common_group
|
||||
WHERE business_group = #{businessGroup}
|
||||
</delete>
|
||||
|
||||
<update id="updateChild">
|
||||
UPDATE wvp_common_group
|
||||
SET parent_device_id=#{group.deviceId},
|
||||
business_group = #{group.businessGroup}
|
||||
WHERE parent_id = #{parentId}
|
||||
</update>
|
||||
|
||||
<select id="queryInGroupListByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group where device_id in
|
||||
<foreach collection='groupList' item='item' open='(' separator=',' close=')'>#{item.deviceId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryInChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group
|
||||
where (device_id, business_group) in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>
|
||||
(#{item.gbParentId}, #{item.gbBusinessGroupId})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryParentInChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group where id in
|
||||
<foreach collection='groupSet' item='item' open='(' separator=',' close=')'>#{item.parentId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryForPlatform" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
SELECT wcg.device_id as gb_device_id,
|
||||
wcg.name as gb_name,
|
||||
wcg.business_group as gb_business_group_id,
|
||||
1 as gb_parental,
|
||||
wcg.parent_device_id as gb_parent_id
|
||||
from wvp_common_group wcg
|
||||
left join wvp_platform_group wpg on wpg.group_id = wcg.id
|
||||
where wpg.platform_id = #{platformId}
|
||||
</select>
|
||||
|
||||
<select id="queryNotShareGroupForPlatformByChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group wcg
|
||||
left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}
|
||||
where wpg.platform_id is null and wcg.device_id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbParentId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryNotShareGroupForPlatformByGroupList" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group wcg
|
||||
left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}
|
||||
where wpg.platform_id IS NULL and wcg.id in
|
||||
<foreach collection='allGroup' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryByChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT * from wvp_common_group where device_id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbParentId}</foreach>
|
||||
order by id
|
||||
</select>
|
||||
|
||||
<update id="updateParentId" databaseId="mysql">
|
||||
update wvp_common_group w1
|
||||
inner join (select * from wvp_common_group) w2 on w1.parent_device_id = w2.device_id
|
||||
set w1.parent_id = w2.id
|
||||
where w1.id in
|
||||
<foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentId" databaseId="postgresql">
|
||||
update wvp_common_group w1
|
||||
set parent_id = w2.id
|
||||
from wvp_common_group w2
|
||||
where w1.parent_device_id = w2.device_id
|
||||
and w1.id in
|
||||
<foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentId" databaseId="kingbase">
|
||||
update wvp_common_group w1
|
||||
set parent_id = w2.id
|
||||
from wvp_common_group w2
|
||||
where w1.parent_device_id = w2.device_id
|
||||
and w1.id in
|
||||
<foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentIdWithBusinessGroup" databaseId="mysql">
|
||||
update wvp_common_group w1
|
||||
inner join (select * from wvp_common_group) w2
|
||||
on w1.parent_device_id is null
|
||||
and w2.parent_device_id is null
|
||||
and w2.device_id = w2.business_group
|
||||
and w1.business_group = w2.device_id
|
||||
and w1.device_id != w1.business_group
|
||||
set w1.parent_id = w2.id
|
||||
where w1.id in
|
||||
<foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentIdWithBusinessGroup" databaseId="kingbase">
|
||||
update wvp_common_group w1
|
||||
set parent_id = w2.id
|
||||
from wvp_common_group w2
|
||||
where w1.parent_device_id is null
|
||||
and w2.parent_device_id is null
|
||||
and w2.device_id = w2.business_group
|
||||
and w1.business_group = w2.device_id
|
||||
and w1.device_id != w1.business_group
|
||||
and w1.id in
|
||||
<foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentIdWithBusinessGroup" databaseId="postgresql">
|
||||
update wvp_common_group w1
|
||||
set parent_id = w2.id
|
||||
from wvp_common_group w2
|
||||
where w1.parent_device_id is null
|
||||
and w2.parent_device_id is null
|
||||
and w2.device_id = w2.business_group
|
||||
and w1.business_group = w2.device_id
|
||||
and w1.device_id != w1.business_group
|
||||
and w1.id in
|
||||
<foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="queryForPlatformByGroupId" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT wp.*
|
||||
from wvp_platform_group wpg
|
||||
left join wvp_platform wp on wp.id = wpg.platform_id
|
||||
where wpg.group_id = #{groupId}
|
||||
</select>
|
||||
|
||||
<delete id="deletePlatformGroup">
|
||||
DELETE
|
||||
FROM wvp_platform_group
|
||||
WHERE group_id = #{groupId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,549 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper">
|
||||
|
||||
<insert id="addChannels">
|
||||
INSERT INTO wvp_platform_channel (platform_id, device_channel_id) VALUES
|
||||
<foreach collection='channelList' item='item' separator=','>
|
||||
(#{platformId}, #{item.gbId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="delChannelForDeviceId">
|
||||
DELETE
|
||||
from wvp_platform_channel
|
||||
WHERE device_channel_id in
|
||||
(select temp.device_channel_id
|
||||
from (select pgc.device_channel_id
|
||||
from wvp_platform_channel pgc
|
||||
left join wvp_device_channel dc on dc.id = pgc.device_channel_id
|
||||
where dc.channel_type = 0
|
||||
and dc.device_id = #{deviceId}) temp)
|
||||
</delete>
|
||||
|
||||
<select id="queryDeviceByPlatformIdAndChannelId" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select d.*
|
||||
from wvp_platform_channel pgc
|
||||
left join wvp_device_channel dc on dc.id = pgc.device_channel_id
|
||||
left join wvp_device d on dc.device_id = d.device_id
|
||||
where dc.channel_type = 0
|
||||
and dc.channel_id = #{channelId}
|
||||
and pgc.platform_id = #{platformId}
|
||||
</select>
|
||||
|
||||
<select id="queryPlatFormListForGBWithGBId" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT wp.* FROM wvp_platform wp
|
||||
left join wvp_platform_channel wpgc on
|
||||
wp.id = wpgc.platform_id WHERE
|
||||
wpgc.device_channel_id = #{channelId} and wp.status = true
|
||||
AND wp.server_gb_id in
|
||||
<foreach collection='platforms' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryDeviceInfoByPlatformIdAndChannelId" resultType="com.genersoft.iot.vmp.gb28181.bean.Device">
|
||||
select dc.channel_id, dc.device_id, dc.name, d.manufacturer, d.model, d.firmware
|
||||
from wvp_platform_channel pgc
|
||||
left join wvp_device_channel dc on dc.id = pgc.device_channel_id
|
||||
left join wvp_device d on dc.device_id = d.device_id
|
||||
where dc.channel_type = 0
|
||||
and dc.channel_id = #{channelId}
|
||||
and pgc.platform_id = #{platformId}
|
||||
</select>
|
||||
|
||||
<select id="queryParentPlatformByChannelId" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT pgc.*
|
||||
from wvp_platform_channel pgc
|
||||
left join wvp_device_channel dc on dc.id = pgc.device_channel_id
|
||||
WHERE dc.channel_type = 0
|
||||
and dc.device_id = #{channelId}
|
||||
</select>
|
||||
|
||||
<select id="queryForPlatformForWebList" resultType="com.genersoft.iot.vmp.gb28181.bean.PlatformChannel">
|
||||
select
|
||||
wpgc.id ,
|
||||
wdc.id as gb_id,
|
||||
wdc.data_type ,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
wpgc.custom_device_id,
|
||||
wpgc.custom_name,
|
||||
wpgc.custom_manufacturer,
|
||||
wpgc.custom_model,
|
||||
wpgc.custom_owner,
|
||||
wpgc.custom_civil_code,
|
||||
wpgc.custom_block,
|
||||
wpgc.custom_address,
|
||||
wpgc.custom_parental,
|
||||
wpgc.custom_parent_id,
|
||||
wpgc.custom_safety_way,
|
||||
wpgc.custom_register_way,
|
||||
wpgc.custom_cert_num,
|
||||
wpgc.custom_certifiable,
|
||||
wpgc.custom_err_code,
|
||||
wpgc.custom_end_time,
|
||||
wpgc.custom_secrecy,
|
||||
wpgc.custom_ip_address,
|
||||
wpgc.custom_port,
|
||||
wpgc.custom_password,
|
||||
wpgc.custom_status,
|
||||
wpgc.custom_longitude,
|
||||
wpgc.custom_latitude,
|
||||
wpgc.custom_ptz_type,
|
||||
wpgc.custom_position_type,
|
||||
wpgc.custom_room_type,
|
||||
wpgc.custom_use_type,
|
||||
wpgc.custom_supply_light_type,
|
||||
wpgc.custom_direction_type,
|
||||
wpgc.custom_resolution,
|
||||
wpgc.custom_business_group_id,
|
||||
wpgc.custom_download_speed,
|
||||
wpgc.custom_svc_space_support_mod,
|
||||
wpgc.custom_svc_time_support_mode,
|
||||
coalesce( wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce( wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce( wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce( wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce( wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce( wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce( wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce( wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce( wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce( wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce( wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce( wdc.gb_register_way, wdc.register_way) as gb_register_way,
|
||||
coalesce( wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce( wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,
|
||||
coalesce( wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce( wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce( wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce( wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce( wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce( wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce( wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce( wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce( wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce( wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce( wdc.gb_position_type, wdc.position_type) as gb_position_type,
|
||||
coalesce( wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce( wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce( wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,
|
||||
coalesce( wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,
|
||||
coalesce( wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce( wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,
|
||||
coalesce( wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,
|
||||
coalesce( wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,
|
||||
coalesce( wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode,
|
||||
wpgc.platform_id
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}
|
||||
where wdc.channel_type = 0
|
||||
<if test='query != null'>
|
||||
AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%')
|
||||
OR wpgc.custom_device_id LIKE concat('%',#{query},'%')
|
||||
OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%')
|
||||
OR wpgc.custom_name LIKE concat('%',#{query},'%'))
|
||||
</if>
|
||||
<if test='online == true'>AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'ON'</if>
|
||||
<if test='online == false'>AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF'</if>
|
||||
<if test='hasShare == true'>AND wpgc.platform_id = #{platformId}</if>
|
||||
<if test='hasShare == false'>AND wpgc.platform_id is null</if>
|
||||
<if test='dataType != null'>AND wdc.data_type = #{dataType}</if>
|
||||
</select>
|
||||
|
||||
<select id="queryOneWithPlatform" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
select wdc.id as gb_id,
|
||||
wdc.data_type,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer,
|
||||
wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce(wpgc.custom_register_way, wdc.gb_register_way,
|
||||
wdc.register_way) as gb_register_way,
|
||||
coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce(wpgc.custom_certifiable, wdc.gb_certifiable,
|
||||
wdc.certifiable) as gb_certifiable,
|
||||
coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce(wpgc.custom_position_type, wdc.gb_position_type,
|
||||
wdc.position_type) as gb_position_type,
|
||||
coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type,
|
||||
wdc.supply_light_type) as gb_supply_light_type,
|
||||
coalesce(wpgc.custom_direction_type, wdc.gb_direction_type,
|
||||
wdc.direction_type) as gb_direction_type,
|
||||
coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id,
|
||||
wdc.business_group_id) as gb_business_group_id,
|
||||
coalesce(wpgc.custom_download_speed, wdc.gb_download_speed,
|
||||
wdc.download_speed) as gb_download_speed,
|
||||
coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod,
|
||||
wdc.svc_space_support_mod) as gb_svc_space_support_mod,
|
||||
coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode,
|
||||
wdc.svc_time_support_mode) as gb_svc_time_support_mode
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id
|
||||
where wdc.channel_type = 0
|
||||
and wpgc.platform_id = #{platformId}
|
||||
and coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}
|
||||
order by wdc.id
|
||||
</select>
|
||||
|
||||
<select id="queryNotShare" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
select
|
||||
wdc.id as gb_id,
|
||||
wdc.data_type,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,
|
||||
coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,
|
||||
coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,
|
||||
coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as
|
||||
gb_supply_light_type,
|
||||
coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,
|
||||
coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as
|
||||
gb_business_group_id,
|
||||
coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,
|
||||
coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as
|
||||
gb_svc_space_support_mod,
|
||||
coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as
|
||||
gb_svc_time_support_mode
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}
|
||||
where wdc.channel_type = 0 and wpgc.platform_id is null
|
||||
<if test='channelIds != null'>
|
||||
AND wdc.id in
|
||||
<foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryShare" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
select
|
||||
wdc.id as gb_id,
|
||||
wdc.data_type,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce(wpgc.custom_register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,
|
||||
coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce(wpgc.custom_certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,
|
||||
coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce(wpgc.custom_position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,
|
||||
coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as
|
||||
gb_supply_light_type,
|
||||
coalesce(wpgc.custom_direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,
|
||||
coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as
|
||||
gb_business_group_id,
|
||||
coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,
|
||||
coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as
|
||||
gb_svc_space_support_mod,
|
||||
coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as
|
||||
gb_svc_time_support_mode
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id
|
||||
where wdc.channel_type = 0 and wpgc.platform_id = #{platformId}
|
||||
<if test='channelIds != null'>AND wdc.id in
|
||||
<foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
order by wdc.id
|
||||
</select>
|
||||
|
||||
<delete id="removeChannelsWithPlatform">
|
||||
DELETE from wvp_platform_channel WHERE platform_id=#{platformId}
|
||||
<if test='channelList != null'>AND device_channel_id in
|
||||
<foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>
|
||||
#{item.gbId}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<delete id="removeChannels">
|
||||
DELETE from wvp_platform_channel WHERE
|
||||
<if test='channelList != null'>AND device_channel_id in
|
||||
<foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>
|
||||
#{item.gbId}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<insert id="addPlatformGroup">
|
||||
INSERT INTO wvp_platform_group (platform_id, group_id) VALUES
|
||||
<foreach collection='groupListNotShare' item='item' separator=','>
|
||||
(#{platformId}, #{item.id})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="addPlatformRegion">
|
||||
INSERT INTO wvp_platform_region (platform_id, region_id) VALUES
|
||||
<foreach collection='regionListNotShare' item='item' separator=','>
|
||||
(#{platformId}, #{item.id})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="removePlatformGroup">
|
||||
DELETE from wvp_platform_group WHERE platform_id=#{platformId} AND group_id in
|
||||
<foreach collection='groupList' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="removePlatformGroupById">
|
||||
DELETE
|
||||
from wvp_platform_group
|
||||
WHERE platform_id = #{platformId}
|
||||
AND group_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="removePlatformRegionById">
|
||||
DELETE
|
||||
from wvp_platform_region
|
||||
WHERE platform_id = #{platformId}
|
||||
AND region_id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryShareChildrenGroup" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT wcg.*
|
||||
from wvp_common_group wcg
|
||||
left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}
|
||||
where wpg.platform_id IS NOT NULL
|
||||
and wcg.parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="queryShareChildrenRegion" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT wcr.*
|
||||
from wvp_common_region wcr
|
||||
left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}
|
||||
where wpr.platform_id IS NOT NULL
|
||||
and wcr.parent_device_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="queryShareParentGroupByGroupSet" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT wcg.* from wvp_common_group wcg
|
||||
left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}
|
||||
where wpg.platform_id is not null and wcg.id in
|
||||
<foreach collection='groupSet' item='item' open='(' separator=',' close=')'>#{item.parentId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryShareParentRegionByRegionSet" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT wcr.* from wvp_common_region wcr
|
||||
left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}
|
||||
where wpr.platform_id is not null and wcr.id in
|
||||
<foreach collection='regionSet' item='item' open='(' separator=',' close=')'>#{item.parentId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryPlatFormListByChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT pp.* FROM wvp_platform pp
|
||||
left join wvp_platform_channel pgc on pp.id = pgc.platform_id
|
||||
left join wvp_device_channel dc on dc.id = pgc.device_channel_id
|
||||
WHERE pgc.device_channel_id IN
|
||||
<foreach collection='ids' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryPlatFormListByChannelId" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT pp.*
|
||||
FROM wvp_platform pp
|
||||
left join wvp_platform_channel pgc on pp.id = pgc.platform_id
|
||||
left join wvp_device_channel dc on dc.id = pgc.device_channel_id
|
||||
WHERE pgc.device_channel_id = #{channelId}
|
||||
</select>
|
||||
|
||||
<delete id="removeChannelsByPlatformId">
|
||||
DELETE
|
||||
from wvp_platform_channel
|
||||
WHERE platform_id = #{platformId}
|
||||
</delete>
|
||||
|
||||
<delete id="removePlatformGroupsByPlatformId">
|
||||
DELETE
|
||||
from wvp_platform_group
|
||||
WHERE platform_id = #{platformId}
|
||||
</delete>
|
||||
|
||||
<delete id="removePlatformRegionByPlatformId">
|
||||
DELETE
|
||||
from wvp_platform_region
|
||||
WHERE platform_id = #{platformId}
|
||||
</delete>
|
||||
|
||||
<update id="updateCustomChannel">
|
||||
UPDATE wvp_platform_channel
|
||||
SET custom_device_id =#{customDeviceId},
|
||||
custom_name =#{customName},
|
||||
custom_manufacturer =#{customManufacturer},
|
||||
custom_model =#{customModel},
|
||||
custom_owner =#{customOwner},
|
||||
custom_civil_code =#{customCivilCode},
|
||||
custom_block =#{customBlock},
|
||||
custom_address =#{customAddress},
|
||||
custom_parental =#{customParental},
|
||||
custom_parent_id =#{customParentId},
|
||||
custom_safety_way =#{customSafetyWay},
|
||||
custom_register_way =#{customRegisterWay},
|
||||
custom_cert_num =#{customCertNum},
|
||||
custom_certifiable =#{customCertifiable},
|
||||
custom_err_code =#{customErrCode},
|
||||
custom_end_time =#{customEndTime},
|
||||
custom_secrecy =#{customSecrecy},
|
||||
custom_ip_address =#{customIpAddress},
|
||||
custom_port =#{customPort},
|
||||
custom_password =#{customPassword},
|
||||
custom_status =#{customStatus},
|
||||
custom_longitude =#{customLongitude},
|
||||
custom_latitude =#{customLatitude},
|
||||
custom_ptz_type =#{customPtzType},
|
||||
custom_position_type =#{customPositionType},
|
||||
custom_room_type =#{customRoomType},
|
||||
custom_use_type =#{customUseType},
|
||||
custom_supply_light_type =#{customSupplyLightType},
|
||||
custom_direction_type =#{customDirectionType},
|
||||
custom_resolution =#{customResolution},
|
||||
custom_business_group_id =#{customBusinessGroupId},
|
||||
custom_download_speed =#{customDownloadSpeed},
|
||||
custom_svc_space_support_mod =#{customSvcSpaceSupportMod},
|
||||
custom_svc_time_support_mode = #{customSvcTimeSupportMode}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="queryShareChannel" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
select wdc.id as gb_id,
|
||||
wdc.data_type,
|
||||
wdc.data_device_id,
|
||||
wdc.create_time,
|
||||
wdc.update_time,
|
||||
coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,
|
||||
coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,
|
||||
coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer,
|
||||
wdc.manufacturer) as gb_manufacturer,
|
||||
coalesce(wpgc.custom_model, wdc.gb_model, wdc.model) as gb_model,
|
||||
coalesce(wpgc.custom_owner, wdc.gb_owner, wdc.owner) as gb_owner,
|
||||
coalesce(wpgc.custom_civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,
|
||||
coalesce(wpgc.custom_block, wdc.gb_block, wdc.block) as gb_block,
|
||||
coalesce(wpgc.custom_address, wdc.gb_address, wdc.address) as gb_address,
|
||||
coalesce(wpgc.custom_parental, wdc.gb_parental, wdc.parental) as gb_parental,
|
||||
coalesce(wpgc.custom_parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,
|
||||
coalesce(wpgc.custom_safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,
|
||||
coalesce(wpgc.custom_register_way, wdc.gb_register_way,
|
||||
wdc.register_way) as gb_register_way,
|
||||
coalesce(wpgc.custom_cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,
|
||||
coalesce(wpgc.custom_certifiable, wdc.gb_certifiable,
|
||||
wdc.certifiable) as gb_certifiable,
|
||||
coalesce(wpgc.custom_err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,
|
||||
coalesce(wpgc.custom_end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,
|
||||
coalesce(wpgc.custom_secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,
|
||||
coalesce(wpgc.custom_ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,
|
||||
coalesce(wpgc.custom_port, wdc.gb_port, wdc.port) as gb_port,
|
||||
coalesce(wpgc.custom_password, wdc.gb_password, wdc.password) as gb_password,
|
||||
coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) as gb_status,
|
||||
coalesce(wpgc.custom_longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,
|
||||
coalesce(wpgc.custom_latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,
|
||||
coalesce(wpgc.custom_ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,
|
||||
coalesce(wpgc.custom_position_type, wdc.gb_position_type,
|
||||
wdc.position_type) as gb_position_type,
|
||||
coalesce(wpgc.custom_room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,
|
||||
coalesce(wpgc.custom_use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,
|
||||
coalesce(wpgc.custom_supply_light_type, wdc.gb_supply_light_type,
|
||||
wdc.supply_light_type) as gb_supply_light_type,
|
||||
coalesce(wpgc.custom_direction_type, wdc.gb_direction_type,
|
||||
wdc.direction_type) as gb_direction_type,
|
||||
coalesce(wpgc.custom_resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,
|
||||
coalesce(wpgc.custom_business_group_id, wdc.gb_business_group_id,
|
||||
wdc.business_group_id) as gb_business_group_id,
|
||||
coalesce(wpgc.custom_download_speed, wdc.gb_download_speed,
|
||||
wdc.download_speed) as gb_download_speed,
|
||||
coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod,
|
||||
wdc.svc_space_support_mod) as gb_svc_space_support_mod,
|
||||
coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode,
|
||||
wdc.svc_time_support_mode) as gb_svc_time_support_mode
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id
|
||||
where wdc.channel_type = 0
|
||||
and wpgc.platform_id = #{platformId}
|
||||
and wdc.id = #{gbId}
|
||||
</select>
|
||||
|
||||
<select id="queryShareGroup" resultType="com.genersoft.iot.vmp.gb28181.bean.Group">
|
||||
SELECT wcg.*
|
||||
from wvp_common_group wcg
|
||||
left join wvp_platform_group wpg on wpg.group_id = wcg.id
|
||||
where wpg.platform_id = #{platformId}
|
||||
order by wcg.id DESC
|
||||
</select>
|
||||
|
||||
<select id="queryShareRegion" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT wcr.*
|
||||
from wvp_common_region wcr
|
||||
left join wvp_platform_region wpr on wpr.region_id = wcr.id
|
||||
where wpr.platform_id = #{platformId}
|
||||
order by wcr.id DESC
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,114 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.PlatformMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_platform
|
||||
(enable, name, server_gb_id, server_gb_domain, server_ip, server_port, device_gb_id, device_ip,
|
||||
device_port, username, password, expires, keep_timeout, transport, character_set, ptz, rtcp, status,
|
||||
catalog_group, update_time, create_time, as_message_channel, send_stream_ip, auto_push_channel,
|
||||
catalog_with_platform, catalog_with_group, catalog_with_region, civil_code, manufacturer, model, address,
|
||||
register_way, secrecy)
|
||||
VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIp}, #{serverPort}, #{deviceGBId},
|
||||
#{deviceIp}, #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport},
|
||||
#{characterSet}, #{ptz}, #{rtcp}, #{status}, #{catalogGroup}, #{updateTime}, #{createTime},
|
||||
#{asMessageChannel}, #{sendStreamIp}, #{autoPushChannel}, #{catalogWithPlatform}, #{catalogWithGroup},
|
||||
#{catalogWithRegion}, #{civilCode}, #{manufacturer}, #{model}, #{address}, #{registerWay}, #{secrecy})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_platform
|
||||
SET update_time=#{updateTime},
|
||||
enable=#{enable},
|
||||
name=#{name},
|
||||
server_gb_id=#{serverGBId},
|
||||
server_gb_domain=#{serverGBDomain},
|
||||
server_ip=#{serverIp},
|
||||
server_port=#{serverPort},
|
||||
device_gb_id=#{deviceGBId},
|
||||
device_ip=#{deviceIp},
|
||||
device_port=#{devicePort},
|
||||
username=#{username},
|
||||
password=#{password},
|
||||
expires=#{expires},
|
||||
keep_timeout=#{keepTimeout},
|
||||
transport=#{transport},
|
||||
character_set=#{characterSet},
|
||||
ptz=#{ptz},
|
||||
rtcp=#{rtcp},
|
||||
status=#{status},
|
||||
catalog_group=#{catalogGroup},
|
||||
as_message_channel=#{asMessageChannel},
|
||||
send_stream_ip=#{sendStreamIp},
|
||||
auto_push_channel=#{autoPushChannel},
|
||||
catalog_with_platform=#{catalogWithPlatform},
|
||||
catalog_with_group=#{catalogWithGroup},
|
||||
catalog_with_region=#{catalogWithRegion},
|
||||
civil_code=#{civilCode},
|
||||
manufacturer=#{manufacturer},
|
||||
model=#{model},
|
||||
address=#{address},
|
||||
register_way=#{registerWay},
|
||||
secrecy=#{secrecy}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
FROM wvp_platform
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryList" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT pp.*,
|
||||
( (SELECT count(0) FROM wvp_platform_channel pc WHERE pc.platform_id = pp.id) +
|
||||
(SELECT count(0) FROM wvp_platform_group pg WHERE pg.platform_id = pp.id) * pp.catalog_with_group +
|
||||
(SELECT count(0) FROM wvp_platform_region pr WHERE pr.platform_id = pp.id) * pp.catalog_with_region +
|
||||
pp.catalog_with_platform
|
||||
) as channel_count
|
||||
FROM wvp_platform pp
|
||||
<where>
|
||||
<if test='query != null'>
|
||||
AND (pp.name LIKE concat('%',#{query},'%') escape '/'
|
||||
OR pp.server_gb_id LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
</where>
|
||||
order by pp.id desc
|
||||
</select>
|
||||
|
||||
<select id="getEnableParentPlatformList" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT *
|
||||
FROM wvp_platform
|
||||
WHERE enable = #{enable}
|
||||
</select>
|
||||
|
||||
<select id="queryEnablePlatformListWithAsMessageChannel" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT *
|
||||
FROM wvp_platform
|
||||
WHERE enable = true
|
||||
and as_message_channel = true
|
||||
</select>
|
||||
|
||||
<select id="getParentPlatByServerGBId" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT *
|
||||
FROM wvp_platform
|
||||
WHERE server_gb_id = #{platformGbId}
|
||||
</select>
|
||||
|
||||
<select id="query" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT *
|
||||
FROM wvp_platform
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateStatus">
|
||||
UPDATE wvp_platform
|
||||
SET status=#{online}
|
||||
WHERE server_gb_id = #{platformGbID}
|
||||
</update>
|
||||
|
||||
<select id="queryEnablePlatformList" resultType="com.genersoft.iot.vmp.gb28181.bean.Platform">
|
||||
SELECT *
|
||||
FROM wvp_platform
|
||||
WHERE enable = true
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,168 @@
|
|||
<?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.genersoft.iot.vmp.gb28181.dao.RegionMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_common_region (device_id, name, parent_id, parent_device_id, create_time, update_time)
|
||||
VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
FROM wvp_common_region
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_common_region
|
||||
SET update_time=#{updateTime},
|
||||
device_id=#{deviceId},
|
||||
name=#{name},
|
||||
parent_id=#{parentId},
|
||||
parent_device_id=#{parentDeviceId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="query" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT * from wvp_common_region
|
||||
<where>
|
||||
<if test='query != null'>
|
||||
AND (device_id LIKE concat('%',#{query},'%') escape '/'
|
||||
OR name LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
<if test='parentId != null'>AND parent_device_id = #{parentId}</if>
|
||||
</where>
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="getChildren" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT *
|
||||
from wvp_common_region
|
||||
WHERE parent_id = #{parentId}
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="queryOne" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT *
|
||||
from wvp_common_region
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getUninitializedCivilCode" resultType="java.lang.String">
|
||||
select dc.civil_code as civil_code
|
||||
from wvp_device_channel dc
|
||||
where dc.civil_code not in
|
||||
(select device_id from wvp_common_region)
|
||||
</select>
|
||||
|
||||
<select id="queryInList" resultType="java.lang.String">
|
||||
SELECT device_id from wvp_common_region where device_id in
|
||||
<foreach collection='codes' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="batchAdd">
|
||||
INSERT INTO wvp_common_region (
|
||||
device_id,
|
||||
name,
|
||||
parent_device_id,
|
||||
parent_id,
|
||||
create_time,
|
||||
update_time)
|
||||
VALUES
|
||||
<foreach collection='regionList' index='index' item='item' separator=','>
|
||||
(#{item.deviceId}, #{item.name},
|
||||
#{item.parentDeviceId},#{item.parentId},#{item.createTime},#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="queryForTree" resultType="com.genersoft.iot.vmp.gb28181.bean.RegionTree">
|
||||
SELECT *, concat('region', id) as tree_id, 0 as type, 'ON' as status, false as is_leaf
|
||||
from wvp_common_region where
|
||||
<if test='parentId != null'>parent_id = #{parentId}</if>
|
||||
<if test='parentId == null'>parent_id is null</if>
|
||||
<if test='query != null'>
|
||||
AND (device_id LIKE concat('%',#{query},'%') escape '/'
|
||||
OR name LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="batchDelete">
|
||||
DELETE FROM wvp_common_region WHERE id in
|
||||
<foreach collection='allChildren' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryInRegionListByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT * from wvp_common_region where device_id in
|
||||
<foreach collection='regionList' item='item' open='(' separator=',' close=')'>#{item.deviceId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryByPlatform" resultType="com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel">
|
||||
SELECT wcr.device_id as gb_device_id,
|
||||
wcr.name as gb_name
|
||||
from wvp_common_region wcr
|
||||
left join wvp_platform_region wpr on wcr.id = wpr.region_id
|
||||
where wpr.platform_id = #{platformId}
|
||||
</select>
|
||||
|
||||
<update id="updateParentId" databaseId="mysql">
|
||||
update wvp_common_region w1
|
||||
inner join (select * from wvp_common_region) w2 on w1.parent_device_id = w2.device_id
|
||||
set w1.parent_id = w2.id where w1.id in
|
||||
<foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentId" databaseId="kingbase">
|
||||
update wvp_common_region w1
|
||||
set parent_id = w2.id
|
||||
from wvp_common_region w2
|
||||
where w1.parent_device_id = w2.device_id
|
||||
and w1.id in
|
||||
<foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateParentId" databaseId="postgresql">
|
||||
update wvp_common_region w1
|
||||
set parent_id = w2.id
|
||||
from wvp_common_region w2
|
||||
where w1.parent_device_id = w2.device_id
|
||||
and w1.id in
|
||||
<foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateChild">
|
||||
update wvp_common_region
|
||||
set parent_device_id = #{parentDeviceId}
|
||||
where parent_id = #{parentId}
|
||||
</update>
|
||||
|
||||
<select id="queryByDeviceId" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT *
|
||||
from wvp_common_region
|
||||
WHERE device_id = #{deviceId}
|
||||
</select>
|
||||
|
||||
<select id="queryParentInChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT * from wvp_common_region where id in
|
||||
<foreach collection='regionSet' item='item' open='(' separator=',' close=')'>#{item.parentId}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryByChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT * from wvp_common_region where device_id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbCivilCode}</foreach>
|
||||
order by id
|
||||
</select>
|
||||
|
||||
<select id="queryNotShareRegionForPlatformByChannelList" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT * from wvp_common_region wcr
|
||||
left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}
|
||||
where wpr.platform_id is null and wcr.device_id in
|
||||
<foreach collection='channelList' item='item' open='(' separator=',' close=')'>#{item.gbCivilCode}</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryNotShareRegionForPlatformByRegionList" resultType="com.genersoft.iot.vmp.gb28181.bean.Region">
|
||||
SELECT * from wvp_common_region wcr
|
||||
left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}
|
||||
where wpr.platform_id IS NULL and wcr.id in
|
||||
<foreach collection='allRegion' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,112 @@
|
|||
<?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.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_cloud_record (
|
||||
app,
|
||||
stream,
|
||||
<if test="callId != null">call_id,</if>
|
||||
start_time,
|
||||
end_time,
|
||||
media_server_id,
|
||||
file_name,
|
||||
folder,
|
||||
file_path,
|
||||
file_size,
|
||||
time_len)
|
||||
VALUES (
|
||||
#{app},
|
||||
#{stream},
|
||||
<if test="callId != null">#{callId},</if>
|
||||
#{startTime},
|
||||
#{endTime},
|
||||
#{mediaServerId},
|
||||
#{fileName},
|
||||
#{folder},
|
||||
#{filePath},
|
||||
#{fileSize},
|
||||
#{timeLen})
|
||||
</insert>
|
||||
|
||||
<select id="getList" resultType="com.genersoft.iot.vmp.service.bean.CloudRecordItem">
|
||||
select *
|
||||
from wvp_cloud_record
|
||||
<where>
|
||||
<if test='query != null'>AND (app LIKE concat('%',#{query},'%') escape '/' OR stream LIKE
|
||||
concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
<if test='app != null '>and app=#{app}</if>
|
||||
<if test='stream != null '>and stream=#{stream}</if>
|
||||
<if test='startTimeStamp != null '>and end_time >= #{startTimeStamp}</if>
|
||||
<if test='endTimeStamp != null '>and start_time <= #{endTimeStamp}</if>
|
||||
<if test='callId != null '>and call_id = #{callId}</if>
|
||||
<if test='mediaServerItemList != null '>and media_server_id in
|
||||
<foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')'>
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test='ids != null '>and id in
|
||||
<foreach collection='ids' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by start_time desc
|
||||
</select>
|
||||
<select id="queryRecordFilePathList" resultType="java.lang.String">
|
||||
select file_path
|
||||
from wvp_cloud_record
|
||||
<where>
|
||||
<if test='app != null '>and app=#{app}</if>
|
||||
<if test='stream != null '>and stream=#{stream}</if>
|
||||
<if test='startTimeStamp != null '>and end_time >= #{startTimeStamp}</if>
|
||||
<if test='endTimeStamp != null '>and start_time <= #{endTimeStamp}</if>
|
||||
<if test='callId != null '>and call_id = #{callId}</if>
|
||||
<if test='mediaServerItemList != null '>and media_server_id in
|
||||
<foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')'>#{item.id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateCollectList">
|
||||
update wvp_cloud_record set collect = #{collect} where file_path in
|
||||
<foreach collection='cloudRecordItemList' item='item' open='(' separator=',' close=')'>
|
||||
#{item.filePath}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteByFileList">
|
||||
delete from wvp_cloud_record where media_server_id=#{mediaServerId} and file_path in
|
||||
<foreach collection='filePathList' item='item' open='(' separator=',' close=')'>#{item}</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryRecordListForDelete" resultType="com.genersoft.iot.vmp.service.bean.CloudRecordItem">
|
||||
select *
|
||||
from wvp_cloud_record
|
||||
where collect = false
|
||||
and end_time <= #{endTimeStamp}
|
||||
and media_server_id = #{mediaServerId}
|
||||
</select>
|
||||
|
||||
<update id="changeCollectById">
|
||||
update wvp_cloud_record
|
||||
set collect = #{collect}
|
||||
where id = #{recordId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteList">
|
||||
delete from wvp_cloud_record where id in
|
||||
<foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')'>#{item.id}</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getListByCallId" resultType="com.genersoft.iot.vmp.service.bean.CloudRecordItem">
|
||||
select *
|
||||
from wvp_cloud_record
|
||||
where call_id = #{callId}
|
||||
</select>
|
||||
|
||||
<select id="queryOne" resultType="com.genersoft.iot.vmp.service.bean.CloudRecordItem">
|
||||
select *
|
||||
from wvp_cloud_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,213 @@
|
|||
<?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.genersoft.iot.vmp.storager.dao.MediaServerMapper">
|
||||
|
||||
<resultMap type="com.genersoft.iot.vmp.media.bean.MediaServer" id="WvpMediaServerResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="ip" column="ip"/>
|
||||
<result property="hookIp" column="hook_ip"/>
|
||||
<result property="sdpIp" column="sdp_ip"/>
|
||||
<result property="streamIp" column="stream_ip"/>
|
||||
<result property="httpPort" column="http_port"/>
|
||||
<result property="httpSSlPort" column="http_ssl_port"/>
|
||||
<result property="rtmpPort" column="rtmp_port"/>
|
||||
<result property="rtmpSSlPort" column="rtmp_ssl_port"/>
|
||||
<result property="rtpProxyPort" column="rtp_proxy_port"/>
|
||||
<result property="rtspPort" column="rtsp_port"/>
|
||||
<result property="rtspSSLPort" column="rtsp_ssl_port"/>
|
||||
<result property="flvPort" column="flv_port"/>
|
||||
<result property="flvSSLPort" column="flv_ssl_port"/>
|
||||
<result property="wsFlvPort" column="ws_flv_port"/>
|
||||
<result property="wsFlvSSLPort" column="ws_flv_ssl_port"/>
|
||||
<result property="autoConfig" column="auto_config"/>
|
||||
<result property="secret" column="secret"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="rtpEnable" column="rtp_enable"/>
|
||||
<result property="rtpPortRange" column="rtp_port_range"/>
|
||||
<result property="sendRtpPortRange" column="send_rtp_port_range"/>
|
||||
<result property="recordAssistPort" column="record_assist_port"/>
|
||||
<result property="defaultServer" column="default_server"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="hookAliveInterval" column="hook_alive_interval"/>
|
||||
<result property="recordPath" column="record_path"/>
|
||||
<result property="recordDay" column="record_day"/>
|
||||
<result property="transcodeSuffix" column="transcode_suffix"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="add" parameterType="com.genersoft.iot.vmp.media.bean.MediaServer">
|
||||
INSERT INTO wvp_media_server
|
||||
(id,
|
||||
ip,
|
||||
hook_ip,
|
||||
sdp_ip,
|
||||
stream_ip,
|
||||
http_port,
|
||||
http_ssl_port,
|
||||
rtmp_port,
|
||||
rtmp_ssl_port,
|
||||
rtp_proxy_port,
|
||||
rtsp_port,
|
||||
flv_port,
|
||||
flv_ssl_port,
|
||||
ws_flv_port,
|
||||
ws_flv_ssl_port,
|
||||
rtsp_ssl_port,
|
||||
auto_config,
|
||||
secret,
|
||||
rtp_enable,
|
||||
rtp_port_range,
|
||||
send_rtp_port_range,
|
||||
record_assist_port,
|
||||
record_day,
|
||||
record_path,
|
||||
default_server,
|
||||
type,
|
||||
create_time,
|
||||
update_time,
|
||||
transcode_suffix,
|
||||
hook_alive_interval)
|
||||
VALUES (#{id},
|
||||
#{ip},
|
||||
#{hookIp},
|
||||
#{sdpIp},
|
||||
#{streamIp},
|
||||
#{httpPort},
|
||||
#{httpSSlPort},
|
||||
#{rtmpPort},
|
||||
#{rtmpSSlPort},
|
||||
#{rtpProxyPort},
|
||||
#{rtspPort},
|
||||
#{flvPort},
|
||||
#{flvSSLPort},
|
||||
#{wsFlvPort},
|
||||
#{wsFlvSSLPort},
|
||||
#{rtspSSLPort},
|
||||
#{autoConfig},
|
||||
#{secret},
|
||||
#{rtpEnable},
|
||||
#{rtpPortRange},
|
||||
#{sendRtpPortRange},
|
||||
#{recordAssistPort},
|
||||
#{recordDay},
|
||||
#{recordPath},
|
||||
#{defaultServer},
|
||||
#{type},
|
||||
#{createTime},
|
||||
#{updateTime},
|
||||
#{transcodeSuffix},
|
||||
#{hookAliveInterval})
|
||||
</insert>
|
||||
<update id="update">
|
||||
UPDATE wvp_media_server
|
||||
SET update_time=#{updateTime}
|
||||
<if test="ip != null">, ip=#{ip}</if>
|
||||
<if test="hookIp != null">, hook_ip=#{hookIp}</if>
|
||||
<if test="sdpIp != null">, sdp_ip=#{sdpIp}</if>
|
||||
<if test="streamIp != null">, stream_ip=#{streamIp}</if>
|
||||
<if test="httpPort != null">, http_port=#{httpPort}</if>
|
||||
<if test="httpSSlPort != null">, http_ssl_port=#{httpSSlPort}</if>
|
||||
<if test="rtmpPort != null">, rtmp_port=#{rtmpPort}</if>
|
||||
<if test="rtmpSSlPort != null">, rtmp_ssl_port=#{rtmpSSlPort}</if>
|
||||
<if test="rtpProxyPort != null">, rtp_proxy_port=#{rtpProxyPort}</if>
|
||||
<if test="rtspPort != null">, rtsp_port=#{rtspPort}</if>
|
||||
<if test="rtspSSLPort != null">, rtsp_ssl_port=#{rtspSSLPort}</if>
|
||||
<if test="flvPort != null">, flv_port=#{flvPort}</if>
|
||||
<if test="flvSSLPort != null">, flv_ssl_port=#{flvSSLPort}</if>
|
||||
<if test="wsFlvPort != null">, ws_flv_port=#{wsFlvPort}</if>
|
||||
<if test="wsFlvSSLPort != null">, ws_flv_ssl_port=#{wsFlvSSLPort}</if>
|
||||
<if test="autoConfig != null">, auto_config=#{autoConfig}</if>
|
||||
<if test="rtpEnable != null">, rtp_enable=#{rtpEnable}</if>
|
||||
<if test="rtpPortRange != null">, rtp_port_range=#{rtpPortRange}</if>
|
||||
<if test="sendRtpPortRange != null">, send_rtp_port_range=#{sendRtpPortRange}</if>
|
||||
<if test="secret != null">, secret=#{secret}</if>
|
||||
<if test="recordAssistPort != null">, record_assist_port=#{recordAssistPort}</if>
|
||||
<if test="hookAliveInterval != null">, hook_alive_interval=#{hookAliveInterval}</if>
|
||||
<if test="recordDay != null">, record_day=#{recordDay}</if>
|
||||
<if test="recordPath != null">, record_path=#{recordPath}</if>
|
||||
<if test="transcodeSuffix != null">, transcode_suffix=#{transcodeSuffix}</if>
|
||||
<if test="type != null">, type=#{type}</if>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateByHostAndPort">
|
||||
UPDATE wvp_media_server
|
||||
SET update_time=#{updateTime}
|
||||
<if test="id != null">, id=#{id}</if>
|
||||
<if test="hookIp != null">, hook_ip=#{hookIp}</if>
|
||||
<if test="sdpIp != null">, sdp_ip=#{sdpIp}</if>
|
||||
<if test="streamIp != null">, stream_ip=#{streamIp}</if>
|
||||
<if test="httpSSlPort != null">, http_ssl_port=#{httpSSlPort}</if>
|
||||
<if test="rtmpPort != null">, rtmp_port=#{rtmpPort}</if>
|
||||
<if test="rtmpSSlPort != null">, rtmp_ssl_port=#{rtmpSSlPort}</if>
|
||||
<if test="rtpProxyPort != null">, rtp_proxy_port=#{rtpProxyPort}</if>
|
||||
<if test="rtspPort != null">, rtsp_port=#{rtspPort}</if>
|
||||
<if test="rtspSSLPort != null">, rtsp_ssl_port=#{rtspSSLPort}</if>
|
||||
<if test="flvPort != null">, flv_port=#{flvPort}</if>
|
||||
<if test="flvSSLPort != null">, flv_ssl_port=#{flvSSLPort}</if>
|
||||
<if test="wsFlvPort != null">, ws_flv_port=#{wsFlvPort}</if>
|
||||
<if test="wsFlvSSLPort != null">, ws_flv_ssl_port=#{wsFlvSSLPort}</if>
|
||||
<if test="autoConfig != null">, auto_config=#{autoConfig}</if>
|
||||
<if test="rtpEnable != null">, rtp_enable=#{rtpEnable}</if>
|
||||
<if test="rtpPortRange != null">, rtp_port_range=#{rtpPortRange}</if>
|
||||
<if test="sendRtpPortRange != null">, send_rtp_port_range=#{sendRtpPortRange}</if>
|
||||
<if test="secret != null">, secret=#{secret}</if>
|
||||
<if test="recordAssistPort != null">, record_assist_port=#{recordAssistPort}</if>
|
||||
<if test="recordDay != null">, record_day=#{recordDay}</if>
|
||||
<if test="recordPath != null">, record_path=#{recordPath}</if>
|
||||
<if test="type != null">, type=#{type}</if>
|
||||
<if test="transcodeSuffix != null">, transcode_suffix=#{transcodeSuffix}</if>
|
||||
<if test="hookAliveInterval != null">, hook_alive_interval=#{hookAliveInterval}</if>
|
||||
WHERE ip=#{ip} and http_port=#{httpPort}
|
||||
</update>
|
||||
|
||||
<select id="queryOne" resultMap="WvpMediaServerResult">
|
||||
SELECT *
|
||||
FROM wvp_media_server
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryAll" resultMap="WvpMediaServerResult">
|
||||
SELECT *
|
||||
FROM wvp_media_server
|
||||
</select>
|
||||
|
||||
<delete id="delOne">
|
||||
DELETE
|
||||
FROM wvp_media_server
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="delOneByIPAndPort">
|
||||
DELETE
|
||||
FROM wvp_media_server
|
||||
WHERE ip = #{host}
|
||||
and http_port = #{port}
|
||||
</delete>
|
||||
|
||||
<delete id="delDefault">
|
||||
DELETE
|
||||
FROM wvp_media_server
|
||||
WHERE default_server = true
|
||||
</delete>
|
||||
|
||||
<select id="queryOneByHostAndPort" resultMap="WvpMediaServerResult">
|
||||
SELECT *
|
||||
FROM wvp_media_server
|
||||
WHERE ip = #{host}
|
||||
and http_port = #{port}
|
||||
</select>
|
||||
|
||||
<select id="queryDefault" resultMap="WvpMediaServerResult">
|
||||
SELECT *
|
||||
FROM wvp_media_server
|
||||
WHERE default_server = true
|
||||
</select>
|
||||
|
||||
<select id="queryAllWithAssistPort" resultMap="WvpMediaServerResult">
|
||||
SELECT *
|
||||
FROM wvp_media_server
|
||||
WHERE record_assist_port > 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,80 @@
|
|||
<?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.genersoft.iot.vmp.storager.dao.RecordPlanMapper">
|
||||
|
||||
<resultMap type="com.genersoft.iot.vmp.service.bean.RecordPlan" id="WvpRecordPlanResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="snap" column="snap" />
|
||||
<result property="name" column="name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_record_plan(name, snap, create_time, update_time)
|
||||
VALUES (#{name}, #{snap}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddItem">
|
||||
INSERT INTO wvp_record_plan_item (
|
||||
start,
|
||||
stop,
|
||||
week_day,
|
||||
plan_id)
|
||||
VALUES
|
||||
<foreach collection='planItemList' index='index' item='item' separator=','>
|
||||
(#{item.start}, #{item.stop}, #{item.weekDay},#{planId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="get" resultMap="WvpRecordPlanResult">
|
||||
select *
|
||||
from wvp_record_plan
|
||||
where id = #{planId}
|
||||
</select>
|
||||
|
||||
<select id="query" resultMap="WvpRecordPlanResult">
|
||||
SELECT wrp.*, (select count(1) from wvp_device_channel where record_plan_id = wrp.id) AS channelCount
|
||||
FROM wvp_record_plan wrp
|
||||
<where>
|
||||
<if test='query != null'>(name LIKE concat('%',#{query},'%') escape '/')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_record_plan
|
||||
SET update_time=#{updateTime},
|
||||
name=#{name},
|
||||
snap=#{snap}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
FROM wvp_record_plan
|
||||
WHERE id = #{planId}
|
||||
</delete>
|
||||
|
||||
<delete id="cleanItems">
|
||||
DELETE
|
||||
FROM wvp_record_plan_item
|
||||
WHERE plan_id = #{planId}
|
||||
</delete>
|
||||
|
||||
<select id="getItemList" resultType="com.genersoft.iot.vmp.service.bean.RecordPlanItem">
|
||||
select *
|
||||
from wvp_record_plan_item
|
||||
where plan_id = #{planId}
|
||||
</select>
|
||||
|
||||
<select id="queryRecordIng" resultType="java.lang.Integer">
|
||||
select wdc.id
|
||||
from wvp_device_channel wdc
|
||||
left join wvp_record_plan_item wrpi on wrpi.plan_id = wdc.record_plan_id
|
||||
where wrpi.week_day = #{week}
|
||||
and wrpi.start <= #{index}
|
||||
and stop >= #{index}
|
||||
group by wdc.id
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,35 @@
|
|||
<?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.genersoft.iot.vmp.storager.dao.RoleMapper">
|
||||
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_user_role (name, authority, create_time, update_time)
|
||||
VALUES (#{name}, #{authority}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_user_role
|
||||
SET update_time=#{updateTime}
|
||||
<if test="name != null">, name=#{name}</if>
|
||||
<if test="authority != null">, authority=#{authority}</if>
|
||||
WHERE id != 1 and id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
from wvp_user_role
|
||||
WHERE id != 1
|
||||
and id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectById" resultType="com.genersoft.iot.vmp.storager.dao.dto.Role">
|
||||
select *
|
||||
from wvp_user_role
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultType="com.genersoft.iot.vmp.storager.dao.dto.Role">
|
||||
select *
|
||||
from wvp_user_role
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,118 @@
|
|||
<?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.genersoft.iot.vmp.storager.dao.UserApiKeyMapper">
|
||||
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_user_api_key (user_id, app, api_key, expired_at, remark, enable, create_time, update_time)
|
||||
VALUES (#{userId}, #{app}, #{apiKey}, #{expiredAt}, #{remark}, #{enable}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_user_api_key
|
||||
SET update_time = #{updateTime}
|
||||
<if test="app != null">, app = #{app}</if>
|
||||
<if test="apiKey != null">, api_key = #{apiKey}</if>
|
||||
<if test="expiredAt != null">, expired_at = #{expiredAt}</if>
|
||||
<if test="remark != null">, username = #{remark}</if>
|
||||
<if test="enable != null">, enable = #{enable}</if>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="enable">
|
||||
UPDATE wvp_user_api_key
|
||||
SET enable = true
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="disable">
|
||||
UPDATE wvp_user_api_key
|
||||
SET enable = false
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="apiKey">
|
||||
UPDATE wvp_user_api_key
|
||||
SET api_key = #{apiKey}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="remark">
|
||||
UPDATE wvp_user_api_key
|
||||
SET remark = #{remark}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
FROM wvp_user_api_key
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectById" resultType="com.genersoft.iot.vmp.storager.dao.dto.UserApiKey">
|
||||
SELECT uak.id,
|
||||
uak.user_id,
|
||||
uak.app,
|
||||
uak.api_key,
|
||||
uak.expired_at,
|
||||
uak.remark,
|
||||
uak.enable,
|
||||
uak.create_time,
|
||||
uak.update_time,
|
||||
u.username AS username
|
||||
FROM wvp_user_api_key uak
|
||||
LEFT JOIN wvp_user u on u.id = uak.user_id
|
||||
WHERE uak.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByApiKey" resultType="com.genersoft.iot.vmp.storager.dao.dto.UserApiKey">
|
||||
SELECT uak.id,
|
||||
uak.user_id,
|
||||
uak.app,
|
||||
uak.api_key,
|
||||
uak.expired_at,
|
||||
uak.remark,
|
||||
uak.enable,
|
||||
uak.create_time,
|
||||
uak.update_time,
|
||||
u.username AS username
|
||||
FROM wvp_user_api_key uak
|
||||
LEFT JOIN wvp_user u on u.id = uak.user_id
|
||||
WHERE uak.api_key = #{apiKey}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultType="com.genersoft.iot.vmp.storager.dao.dto.UserApiKey">
|
||||
SELECT uak.id,
|
||||
uak.user_id,
|
||||
uak.app,
|
||||
uak.api_key,
|
||||
uak.expired_at,
|
||||
uak.remark,
|
||||
uak.enable,
|
||||
uak.create_time,
|
||||
uak.update_time,
|
||||
u.username AS username
|
||||
FROM wvp_user_api_key uak
|
||||
LEFT JOIN wvp_user u on u.id = uak.user_id
|
||||
</select>
|
||||
|
||||
<select id="getUserApiKeys" resultType="com.genersoft.iot.vmp.storager.dao.dto.UserApiKey">
|
||||
SELECT uak.id,
|
||||
uak.user_id,
|
||||
uak.app,
|
||||
uak.api_key,
|
||||
uak.expired_at,
|
||||
uak.remark,
|
||||
uak.enable,
|
||||
uak.create_time,
|
||||
uak.update_time,
|
||||
u.username AS username
|
||||
FROM wvp_user_api_key uak
|
||||
LEFT JOIN wvp_user u on u.id = uak.user_id
|
||||
</select>
|
||||
|
||||
<select id="isApiKeyExists" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(0)
|
||||
FROM wvp_user_api_key
|
||||
WHERE api_key = #{apiKey}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,111 @@
|
|||
<?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.genersoft.iot.vmp.storager.dao.UserMapper">
|
||||
|
||||
<resultMap id="useMap" type="com.genersoft.iot.vmp.storager.dao.dto.User">
|
||||
<id property="id" column="id"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="pushKey" column="push_key"/>
|
||||
<association property="role" javaType="com.genersoft.iot.vmp.storager.dao.dto.Role">
|
||||
<result column="role_id" property="id"/>
|
||||
<result column="role_name" property="name"/>
|
||||
<result column="role_authority" property="authority"/>
|
||||
<result column="role_create_time" property="createTime"/>
|
||||
<result column="role_update_time" property="updateTime"/>
|
||||
</association>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_user (username, password, role_id, push_key, create_time, update_time)
|
||||
VALUES (#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_user
|
||||
SET update_time=#{updateTime}
|
||||
<if test="pushKey != null">, push_key=#{pushKey}</if>
|
||||
<if test="role != null">, role_id=#{role.id}</if>
|
||||
<if test="password != null">, password=#{password}</if>
|
||||
<if test="username != null">, username=#{username}</if>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
from wvp_user
|
||||
WHERE id != 1
|
||||
and id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="select" resultMap="useMap">
|
||||
select u.*,
|
||||
r.name as role_name,
|
||||
r.authority as role_authority,
|
||||
r.create_time as role_create_time,
|
||||
r.update_time as role_update_time
|
||||
from wvp_user u,
|
||||
wvp_user_role r
|
||||
WHERE u.role_id = r.id
|
||||
and u.username = #{username}
|
||||
AND u.password = #{password}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="useMap">
|
||||
select u.*,
|
||||
r.name as role_name,
|
||||
r.authority as role_authority,
|
||||
r.create_time as role_create_time,
|
||||
r.update_time as role_update_time
|
||||
from wvp_user u,
|
||||
wvp_user_role r
|
||||
WHERE u.role_id = r.id
|
||||
and u.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getUserByUsername" resultMap="useMap">
|
||||
select u.*,
|
||||
r.name as role_name,
|
||||
r.authority as role_authority,
|
||||
r.create_time as role_create_time,
|
||||
r.update_time as role_update_time
|
||||
from wvp_user u,
|
||||
wvp_user_role r
|
||||
WHERE u.role_id = r.id
|
||||
and u.username = #{username}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="useMap">
|
||||
select u.*,
|
||||
r.name as role_name,
|
||||
r.authority as role_authority,
|
||||
r.create_time as role_create_time,
|
||||
r.update_time as role_update_time
|
||||
from wvp_user u,
|
||||
wvp_user_role r
|
||||
WHERE u.role_id = r.id
|
||||
</select>
|
||||
|
||||
<select id="getUsers" resultMap="useMap">
|
||||
select u.id,
|
||||
u.username,
|
||||
u.push_key,
|
||||
u.role_id,
|
||||
r.name as role_name,
|
||||
r.authority as role_authority,
|
||||
r.create_time as role_create_time,
|
||||
r.update_time as role_update_time
|
||||
from wvp_user u
|
||||
join wvp_user_role r on u.role_id = r.id
|
||||
</select>
|
||||
|
||||
<update id="changePushKey">
|
||||
UPDATE wvp_user
|
||||
set push_key=#{pushKey}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,142 @@
|
|||
<?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.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper">
|
||||
<sql id="BASE_SELECT_SQL">
|
||||
SELECT st.*,
|
||||
3 as data_type,
|
||||
st.id as data_device_id,
|
||||
wdc.*,
|
||||
wdc.id as gb_id
|
||||
FROM wvp_stream_proxy st
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 3 and st.id = wdc.data_device_id
|
||||
</sql>
|
||||
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_stream_proxy
|
||||
(type, app, stream, relates_media_server_id, src_url,
|
||||
timeout, ffmpeg_cmd_key, rtsp_type, enable_audio, enable_mp4, enable, pulling,
|
||||
enable_remove_none_reader, enable_disable_none_reader, create_time)
|
||||
VALUES (#{type}, #{app}, #{stream}, #{relatesMediaServerId}, #{srcUrl},
|
||||
#{timeout}, #{ffmpegCmdKey}, #{rtspType}, #{enableAudio}, #{enableMp4}, #{enable}, #{pulling},
|
||||
#{enableRemoveNoneReader}, #{enableDisableNoneReader}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_stream_proxy
|
||||
SET type=#{type},
|
||||
app=#{app},
|
||||
stream=#{stream},
|
||||
relates_media_server_id=#{relatesMediaServerId},
|
||||
src_url=#{srcUrl},
|
||||
timeout=#{timeout},
|
||||
ffmpeg_cmd_key=#{ffmpegCmdKey},
|
||||
rtsp_type=#{rtspType},
|
||||
enable_audio=#{enableAudio},
|
||||
enable=#{enable},
|
||||
pulling=#{pulling},
|
||||
enable_remove_none_reader=#{enableRemoveNoneReader},
|
||||
enable_disable_none_reader=#{enableDisableNoneReader},
|
||||
enable_mp4=#{enableMp4}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delByAppAndStream">
|
||||
DELETE
|
||||
FROM wvp_stream_proxy
|
||||
WHERE app = #{app}
|
||||
AND stream = #{stream}
|
||||
</delete>
|
||||
|
||||
<select id="selectAll" resultType="com.genersoft.iot.vmp.streamProxy.bean.StreamProxy">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
<where>
|
||||
<if test="query != null">
|
||||
AND (st.app LIKE concat('%',#{query},'%') escape '/'
|
||||
OR st.stream LIKE concat('%',#{query},'%') escape '/'
|
||||
OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/'
|
||||
OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
<if test="pulling != null">
|
||||
<choose>
|
||||
<when test="pulling = 1">
|
||||
AND st.pulling=1
|
||||
</when>
|
||||
<otherwise>
|
||||
AND st.pulling=0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="mediaServerId != null">
|
||||
AND st.media_server_id=#{mediaServerId}
|
||||
</if>
|
||||
</where>
|
||||
order by st.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectOneByAppAndStream" resultType="com.genersoft.iot.vmp.streamProxy.bean.StreamProxy">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectForPushingInMediaServer" resultType="com.genersoft.iot.vmp.streamProxy.bean.StreamProxy">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getAllCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from wvp_stream_proxy
|
||||
</select>
|
||||
|
||||
<select id="getOnline" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from wvp_stream_proxy
|
||||
where pulling = true
|
||||
</select>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE
|
||||
FROM wvp_stream_proxy
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByList">
|
||||
DELETE FROM wvp_stream_proxy WHERE id in
|
||||
<foreach collection='streamProxiesForRemove' index='index' item='item' separator=',' open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="online">
|
||||
UPDATE wvp_stream_proxy
|
||||
SET pulling = true
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="offline">
|
||||
UPDATE wvp_stream_proxy
|
||||
SET pulling = false
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="select" resultType="com.genersoft.iot.vmp.streamProxy.bean.StreamProxy">
|
||||
<include refid="BASE_SELECT_SQL"/>
|
||||
WHERE st.id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="removeStream">
|
||||
UPDATE wvp_stream_proxy
|
||||
SET pulling= false,
|
||||
media_server_id = null,
|
||||
stream_key = null
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="addStream">
|
||||
UPDATE wvp_stream_proxy
|
||||
SET pulling=#{pulling},
|
||||
media_server_id = #{mediaServerId},
|
||||
stream_key = #{streamKey}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,169 @@
|
|||
<?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.genersoft.iot.vmp.streamPush.dao.StreamPushMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO wvp_stream_push
|
||||
(app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push)
|
||||
VALUES (#{app}, #{stream}, #{mediaServerId}, #{serverId}, #{pushTime}, #{updateTime}, #{createTime}, #{pushing},
|
||||
#{startOfflinePush})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE wvp_stream_push
|
||||
<set>
|
||||
update_time=#{updateTime},
|
||||
<if test="app != null">app=#{app},</if>
|
||||
<if test="stream != null">stream=#{stream},</if>
|
||||
<if test="mediaServerId != null">media_server_id=#{mediaServerId},</if>
|
||||
<if test="serverId != null">server_id=#{serverId},</if>
|
||||
<if test="pushTime != null">push_time=#{pushTime},</if>
|
||||
<if test="pushing != null">pushing=#{pushing},</if>
|
||||
<if test="startOfflinePush != null">start_offline_push=#{startOfflinePush},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="del">
|
||||
DELETE
|
||||
FROM wvp_stream_push
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectAll" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT
|
||||
st.*,
|
||||
st.id as data_device_id,
|
||||
wdc.*,
|
||||
wdc.id as gb_id
|
||||
from wvp_stream_push st
|
||||
LEFT join wvp_device_channel wdc
|
||||
on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
<where>
|
||||
<if test='query != null'>
|
||||
AND (st.app LIKE concat('%',#{query},'%') escape '/'
|
||||
OR st.stream LIKE concat('%',#{query},'%') escape '/'
|
||||
OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/'
|
||||
OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')
|
||||
</if>
|
||||
<if test='pushing == true'>AND st.pushing=1</if>
|
||||
<if test='pushing == false'>AND st.pushing=0</if>
|
||||
<if test='mediaServerId != null'>AND st.media_server_id=#{mediaServerId}</if>
|
||||
</where>
|
||||
order by st.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectByAppAndStream" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id
|
||||
FROM wvp_stream_push st
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
WHERE st.app = #{app}
|
||||
AND st.stream = #{stream}
|
||||
</select>
|
||||
|
||||
<insert id="addAll">
|
||||
Insert INTO wvp_stream_push
|
||||
(app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push)
|
||||
VALUES
|
||||
<foreach collection='streamPushItems' item='item' index='index' separator=','>
|
||||
( #{item.app}, #{item.stream}, #{item.mediaServerId},#{item.serverId} ,#{item.pushTime}, #{item.updateTime},
|
||||
#{item.createTime}, #{item.pushing}, #{item.startOfflinePush})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectAllByMediaServerId" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id
|
||||
FROM wvp_stream_push st
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
WHERE st.media_server_id = #{mediaServerId}
|
||||
</select>
|
||||
|
||||
<select id="selectAllByMediaServerIdWithOutGbID" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id
|
||||
FROM wvp_stream_push st
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
WHERE st.media_server_id = #{mediaServerId}
|
||||
and wdc.gb_device_id is null
|
||||
</select>
|
||||
|
||||
<update id="updatePushStatus">
|
||||
UPDATE wvp_stream_push
|
||||
SET pushing=#{pushing}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getListFromRedis" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join
|
||||
wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
where (st.app, st.stream) in
|
||||
<foreach collection='offlineStreams' item='item' separator=',' open="(" close=")">
|
||||
(#{item.app}, #{item.stream})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getAllAppAndStream" resultType="java.lang.String">
|
||||
SELECT CONCAT(app, stream)
|
||||
from wvp_stream_push
|
||||
</select>
|
||||
|
||||
<select id="getAllCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from wvp_stream_push
|
||||
</select>
|
||||
|
||||
<select id="getAllPushing" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from wvp_stream_push
|
||||
where pushing = true
|
||||
</select>
|
||||
|
||||
<select id="getAllAppAndStreamMap" resultType="java.util.Map">
|
||||
SELECT CONCAT(wsp.app, wsp.stream) as unique_key, wsp.*, wsp.*, wdc.id as gb_id
|
||||
from wvp_stream_push wsp
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id
|
||||
</select>
|
||||
|
||||
<select id="getAllGBId" resultType="java.util.Map">
|
||||
SELECT wdc.gb_device_id, wsp.id as data_device_id, wsp.*, wsp.*, wdc.id as gb_id
|
||||
from wvp_stream_push wsp
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id
|
||||
</select>
|
||||
|
||||
<select id="queryOne" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id
|
||||
FROM wvp_stream_push st
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
WHERE st.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectInSet" resultType="com.genersoft.iot.vmp.streamPush.bean.StreamPush">
|
||||
SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st
|
||||
LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id
|
||||
where st.id in
|
||||
<foreach collection='ids' item='item' separator=',' open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="batchDel">
|
||||
DELETE FROM wvp_stream_push WHERE id in
|
||||
<foreach collection='streamPushList' item='item' separator=',' open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="batchUpdate">
|
||||
<foreach collection='streamPushItemForUpdate' item='item' separator=';'>
|
||||
UPDATE
|
||||
wvp_stream_push
|
||||
SET update_time=#{item.updateTime},
|
||||
app=#{item.app},
|
||||
stream=#{item.stream},
|
||||
media_server_id=#{item.mediaServerId},
|
||||
server_id=#{item.serverId},
|
||||
push_time=#{item.pushTime},
|
||||
pushing=#{item.pushing},
|
||||
start_offline_push=#{item.startOfflinePush}
|
||||
WHERE id=#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue