diff --git a/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java
index 7f25a3629..682d9af3e 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java
@@ -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);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java
index cf344dd8b..7de234422 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java
@@ -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(" ")
@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 = {" "})
int update(CommonGBChannel commonGBChannel);
- @Update(value = {" "})
int updateStatusById(@Param("gbId") int gbId, @Param("status") String status);
- @Update("")
int updateStatusForListById(List commonGBChannels, @Param("status") String status);
- @SelectProvider(type = ChannelProvider.class, method = "queryInListByStatus")
List queryInListByStatus(List commonGBChannelList, @Param("status") String status);
-
- @Insert(" ")
int batchAdd(List commonGBChannels);
- @Update("")
int updateStatus(List commonGBChannels);
- @Update(value = {" "})
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 queryByIds(Collection ids);
- @Delete(value = {" "})
void batchDelete(List channelListInDb);
- @SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode")
List queryListByCivilCode(@Param("query") String query, @Param("online") Boolean online,
@Param("dataType") Integer dataType, @Param("civilCode") String civilCode);
-
-
- @SelectProvider(type = ChannelProvider.class, method = "queryListByParentId")
List queryListByParentId(@Param("query") String query, @Param("online") Boolean online,
@Param("dataType") Integer dataType, @Param("groupDeviceId") String groupDeviceId);
-
- @Select("")
List queryForRegionTreeByCivilCode(@Param("query") String query, @Param("parentDeviceId") String parentDeviceId);
- @Update(value = {" "})
int removeCivilCode(List allChildren);
-
- @Update(value = {" "})
int updateRegion(@Param("civilCode") String civilCode, @Param("channelList") List channelList);
- @SelectProvider(type = ChannelProvider.class, method = "queryByIdsOrCivilCode")
List queryByIdsOrCivilCode(@Param("civilCode") String civilCode, @Param("ids") List ids);
- @Update(value = {" "})
int removeCivilCodeByChannels(List channelList);
- @SelectProvider(type = ChannelProvider.class, method = "queryByCivilCode")
List queryByCivilCode(@Param("civilCode") String civilCode);
- @SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds")
List queryByGbDeviceIds(@Param("dataType") Integer dataType, List deviceIds);
- @Select(value = {" "})
List queryByGbDeviceIdsForIds(@Param("dataType") Integer dataType, List deviceIds);
- @SelectProvider(type = ChannelProvider.class, method = "queryByGroupList")
List queryByGroupList(List groupList);
- @Update(value = {" "})
int removeParentIdByChannels(List channelList);
- @SelectProvider(type = ChannelProvider.class, method = "queryByBusinessGroup")
List queryByBusinessGroup(@Param("businessGroup") String businessGroup);
- @SelectProvider(type = ChannelProvider.class, method = "queryByParentId")
List queryByParentId(@Param("parentId") String parentId);
- @Update(value = {" "})
int updateBusinessGroupByChannelList(@Param("businessGroup") String businessGroup, List channelList);
- @Update(value = {" "})
int updateParentIdByChannelList(@Param("parentId") String parentId, List channelList);
- @Select("")
List queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
- @Update(value = {" "})
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
List channelList);
- @Update({""})
int batchUpdate(List commonGBChannels);
- @SelectProvider(type = ChannelProvider.class, method = "queryWithPlatform")
List queryWithPlatform(@Param("platformId") Integer platformId);
- @SelectProvider(type = ChannelProvider.class, method = "queryShareChannelByParentId")
List queryShareChannelByParentId(@Param("parentId") String parentId, @Param("platformId") Integer platformId);
- @SelectProvider(type = ChannelProvider.class, method = "queryShareChannelByCivilCode")
List queryShareChannelByCivilCode(@Param("civilCode") String civilCode, @Param("platformId") Integer platformId);
- @Update(value = {" "})
int updateCivilCodeByChannelList(@Param("civilCode") String civilCode, List channelList);
- @SelectProvider(type = ChannelProvider.class, method = "queryListByStreamPushList")
List queryListByStreamPushList(@Param("dataType") Integer dataType, List streamPushList);
- @Update(value = {" "})
- void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List channels);
+ void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List channels);
- @SelectProvider(type = ChannelProvider.class, method = "queryList")
List queryList(@Param("query") String query, @Param("online") Boolean online,
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType);
- @Update(value = {" "})
void removeRecordPlan(List channelIds);
- @Update(value = {" "})
void addRecordPlan(List channelIds, @Param("planId") Integer planId);
- @Update(value = {" "})
void addRecordPlanForAll(@Param("planId") Integer planId);
- @Update(value = {" "})
- void removeRecordPlanByPlanId( @Param("planId") Integer planId);
+ void removeRecordPlanByPlanId(@Param("planId") Integer planId);
-
- @Select("")
List 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);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceAlarmMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceAlarmMapper.java
index e885e6b4c..9bbde215f 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceAlarmMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceAlarmMapper.java
@@ -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 = {" "})
List 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(" "
- )
int clearAlarmBeforeTime(@Param("id") Integer id, @Param("deviceIdList") List deviceIdList, @Param("time") String time);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java
index f700dad8f..728cfc7c4 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java
@@ -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("")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int add(DeviceChannel channel);
- @Update(value = {" "})
int update(DeviceChannel channel);
- @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels")
List 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 channelIds);
- @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId")
List queryChannelsByDeviceDbId(@Param("dataDeviceId") int dataDeviceId);
- @Select("")
List queryChaneIdListByDeviceDbIds(List 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 = {" "})
- List queryChannelsWithDeviceInfo( @Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List channelIds);
+ List queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List 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 = {" "})
List 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("")
int batchAdd(@Param("addChannels") List addChannels);
-
- @Update(value = {"UPDATE wvp_device_channel SET status='ON' WHERE id=#{id}"})
void online(@Param("id") int id);
- @Update({""})
int batchUpdate(List updateChannels);
-
- @Update({""})
int batchUpdateForNotify(List 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 = {" "})
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 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 getDeviceByChannelDeviceId(@Param("channelId") String channelId);
-
- @Delete({""})
int batchDel(List deleteChannelList);
- @Update({""})
int batchUpdateStatus(List 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("")
void updateChannelStreamIdentification(DeviceChannel channel);
- @Update("")
void updateAllChannelStreamIdentification(@Param("streamIdentification") String streamIdentification);
- @Update({""})
void batchUpdatePosition(List channelList);
- @SelectProvider(type = DeviceChannelProvider.class, method = "getOne")
DeviceChannel getOne(@Param("id") int id);
- @Select(value = {" "})
DeviceChannel getOneForSource(@Param("id") int id);
- @SelectProvider(type = DeviceChannelProvider.class, method = "getOneByDeviceId")
DeviceChannel getOneByDeviceId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
-
- @Select(value = {" "})
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 = {" "})
void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio);
- @Update("")
void updateStreamGPS(List 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({""})
void updateChannelForNotify(DeviceChannel channel);
-
- @Select(value = {" "})
DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java
index 3f50e4358..fbe4e660a 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java
@@ -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 = {" "})
int update(Device device);
- @Select(
- " "
- )
List 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 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 = {" "})
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 getAll();
- @Select("select * FROM wvp_device where as_message_channel = true")
List queryDeviceWithAsMessageChannel();
- @Select(" ")
List 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 = {" "})
void updateSubscribeCatalog(Device device);
- @Update(value = {" "})
void updateSubscribeMobilePosition(Device device);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java
index 3e09df8ce..99a67d658 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMobilePositionMapper.java
@@ -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 = {" "})
List 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("")
void batchadd(List mobilePositions);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java
index 1c89a4689..704ee8104 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java
@@ -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 = {" "})
List query(@Param("query") String query, @Param("parentId") String parentId, @Param("businessGroup") String businessGroup);
- @Select("SELECT * from wvp_common_group WHERE parent_id = #{parentId} ")
List getChildren(@Param("parentId") int parentId);
- @Select("SELECT * from wvp_common_group WHERE id = #{id} ")
Group queryOne(@Param("id") int id);
-
- @Insert(" ")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int batchAdd(List groupList);
- @Select(" ")
List queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
- @Select(" ")
List queryForTreeByBusinessGroup(@Param("query") String query,
@Param("businessGroup") String businessGroup);
- @Select(" ")
List 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("")
int batchDelete(List 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 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(" ")
List queryInGroupListByDeviceId(List groupList);
- @Select(" ")
Set queryInChannelList(List channelList);
- @Select(" ")
Set queryParentInChannelList(Set groupSet);
- @Select(" ")
List queryForPlatform(@Param("platformId") Integer platformId);
- @Select(" ")
Set queryNotShareGroupForPlatformByChannelList(List channelList, @Param("platformId") Integer platformId);
- @Select(" ")
Set queryNotShareGroupForPlatformByGroupList(Set allGroup, @Param("platformId") Integer platformId);
-
- @Select(" ")
Set queryByChannelList(List channelList);
- @Update(value = " ", databaseId = "mysql")
- @Update( value = " ", databaseId = "postgresql")
- @Update( value = " ", databaseId = "kingbase")
void updateParentId(List groupListForAdd);
- @Update(value = " ", databaseId = "mysql")
- @Update( value = " ", databaseId = "kingbase")
- @Update( value = " ", databaseId = "postgresql")
void updateParentIdWithBusinessGroup(List groupListForAdd);
- @Select(" ")
List queryForPlatformByGroupId(@Param("groupId") int groupId);
- @Delete("DELETE FROM wvp_platform_group WHERE group_id = #{groupId}")
void deletePlatformGroup(@Param("groupId") int groupId);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java
index 9a565628b..b3d16d849 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java
@@ -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("")
int addChannels(@Param("platformId") Integer platformId, @Param("channelList") List channelList);
- @Delete("")
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 queryDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
- @Select(" ")
List queryPlatFormListForGBWithGBId(@Param("channelId") Integer channelId, List 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 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 queryParentPlatformByChannelId(@Param("channelId") String channelId);
- @Select("")
List 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 queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
-
- @Select("")
List queryNotShare(@Param("platformId") Integer platformId, List channelIds);
- @Select("")
List queryShare(@Param("platformId") Integer platformId, List channelIds);
- @Delete("")
int removeChannelsWithPlatform(@Param("platformId") Integer platformId, List channelList);
- @Delete("")
int removeChannels(List channelList);
- @Insert("")
int addPlatformGroup(Collection groupListNotShare, @Param("platformId") Integer platformId);
- @Insert("")
int addPlatformRegion(List regionListNotShare, @Param("platformId") Integer platformId);
- @Delete("")
int removePlatformGroup(List groupList, @Param("platformId") Integer platformId);
- @Delete("")
void removePlatformGroupById(@Param("id") int id, @Param("platformId") Integer platformId);
- @Delete("")
void removePlatformRegionById(@Param("id") int id, @Param("platformId") Integer platformId);
- @Select(" ")
Set queryShareChildrenGroup(@Param("parentId") Integer parentId, @Param("platformId") Integer platformId);
- @Select(" ")
Set queryShareChildrenRegion(@Param("parentId") String parentId, @Param("platformId") Integer platformId);
- @Select(" ")
Set queryShareParentGroupByGroupSet(Set groupSet, @Param("platformId") Integer platformId);
- @Select(" ")
Set queryShareParentRegionByRegionSet(Set regionSet, @Param("platformId") Integer platformId);
- @Select(" ")
List queryPlatFormListByChannelList(Collection ids);
- @Select(" ")
List queryPlatFormListByChannelId(@Param("channelId") int channelId);
- @Delete("")
void removeChannelsByPlatformId(@Param("platformId") Integer platformId);
- @Delete("")
void removePlatformGroupsByPlatformId(@Param("platformId") Integer platformId);
- @Delete("")
void removePlatformRegionByPlatformId(@Param("platformId") Integer platformId);
- @Update(value = {" "})
void updateCustomChannel(PlatformChannel channel);
-
- @Select("")
CommonGBChannel queryShareChannel(@Param("platformId") int platformId, @Param("gbId") int gbId);
-
- @Select(" ")
Set queryShareGroup(@Param("platformId") Integer platformId);
- @Select(" ")
Set queryShareRegion(Integer id);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java
index b8080bb5d..d874b49f5 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java
@@ -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(" ")
List queryList(@Param("query") String query);
- @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List getEnableParentPlatformList(boolean enable);
- @Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
List 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 queryEnablePlatformList();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java
index f31146721..74b42e17e 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java
@@ -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 = {" "})
List query(@Param("query") String query, @Param("parentId") String parentId);
- @Select("SELECT * from wvp_common_region WHERE parent_id = #{parentId} ORDER BY id ")
List 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 getUninitializedCivilCode();
- @Select(" ")
List queryInList(Set codes);
-
- @Insert(" ")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int batchAdd(List regionList);
- @Select(" ")
List queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
- @Delete("")
void batchDelete(List allChildren);
- @Select(" ")
List queryInRegionListByDeviceId(List regionList);
- @Select(" ")
List queryByPlatform(@Param("platformId") Integer platformId);
-
- @Update(value = " ", databaseId = "mysql")
- @Update( value = " ", databaseId = "kingbase")
- @Update( value = " ", databaseId = "postgresql")
void updateParentId(List regionListForAdd);
- @Update(" ")
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(" ")
Set queryParentInChannelList(Set regionSet);
- @Select(" ")
Set queryByChannelList(List channelList);
- @Select(" ")
Set queryNotShareRegionForPlatformByChannelList(List channelList, @Param("platformId") Integer platformId);
- @Select(" ")
Set queryNotShareRegionForPlatformByRegionList(Set allRegion, @Param("platformId") Integer platformId);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java
deleted file mode 100644
index 245adbc0f..000000000
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java
+++ /dev/null
@@ -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 params ){
- return BASE_SQL + " where channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
- }
-
- public String queryById(Map params ){
- return BASE_SQL + " where channel_type = 0 and id = #{gbId}";
- }
-
- public String queryByDataId(Map params ){
- return BASE_SQL + " where channel_type = 0 and data_type = #{dataType} and data_device_id = #{dataDeviceId}";
- }
-
- public String queryListByCivilCode(Map 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 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 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 params ){
- StringBuilder sqlBuild = new StringBuilder();
- sqlBuild.append(BASE_SQL);
- sqlBuild.append("where channel_type = 0 and gb_status=#{status} and id in ( ");
-
- List commonGBChannelList = (List)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 params ){
- StringBuilder sqlBuild = new StringBuilder();
- sqlBuild.append(BASE_SQL);
- sqlBuild.append("where channel_type = 0 and id in ( ");
-
- Collection ids = (Collection)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 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 ids = (Collection)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 params ){
- StringBuilder sqlBuild = new StringBuilder();
- sqlBuild.append(BASE_SQL);
- sqlBuild.append("where channel_type = 0 and id in ( ");
-
- Collection ids = (Collection)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 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 ids = (Collection)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 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 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 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 params ){
- StringBuilder sqlBuild = new StringBuilder();
- sqlBuild.append(BASE_SQL);
-
- sqlBuild.append(" where channel_type = 0 and gb_parent_id in ( ");
- Collection ids = (Collection)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 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 ids = (Collection)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 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 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 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() ;
- }
-}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java
deleted file mode 100644
index eece8399e..000000000
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java
+++ /dev/null
@@ -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 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 channelIds = (List)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 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 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 params ){
- StringBuilder sqlBuild = new StringBuilder();
- sqlBuild.append(getBaseSelectSql());
- sqlBuild.append(" where dc.id=#{id}");
- return sqlBuild.toString();
- }
-
- public String getOneByDeviceId(Map 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 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 params ){
- return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and id = #{gbId}";
- }
-
-
- public String queryList(Map 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();
- }
-}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
index 7e7ee54c3..0533d98c0 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
@@ -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(" ")
int add(CloudRecordItem cloudRecordItem);
- @Select(" ")
List 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 mediaServerItemList,
+ @Param("startTimeStamp") Long startTimeStamp, @Param("endTimeStamp") Long endTimeStamp,
+ @Param("callId") String callId, List mediaServerItemList,
List ids);
-
- @Select(" ")
List queryRecordFilePathList(@Param("app") String app, @Param("stream") String stream,
- @Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
- @Param("callId")String callId, List mediaServerItemList);
+ @Param("startTimeStamp") Long startTimeStamp, @Param("endTimeStamp") Long endTimeStamp,
+ @Param("callId") String callId, List mediaServerItemList);
- @Update(" ")
int updateCollectList(@Param("collect") boolean collect, List cloudRecordItemList);
- @Delete(" ")
void deleteByFileList(List filePathList, @Param("mediaServerId") String mediaServerId);
+ List queryRecordListForDelete(@Param("endTimeStamp") Long endTimeStamp, String mediaServerId);
- @Select(" ")
- List queryRecordListForDelete(@Param("endTimeStamp")Long endTimeStamp, String mediaServerId);
-
- @Update(" ")
int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId);
- @Delete(" ")
int deleteList(List cloudRecordItemIdList);
- @Select(" ")
List getListByCallId(@Param("callId") String callId);
- @Select(" ")
CloudRecordItem queryOne(@Param("id") Integer id);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
index 2f2bfb6d7..f531c687e 100755
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
@@ -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 = {" "})
int update(MediaServer mediaServerItem);
- @Update(value = {" "})
+
int updateByHostAndPort(MediaServer mediaServerItem);
- @Select("SELECT * FROM wvp_media_server WHERE id=#{id}")
MediaServer queryOne(String id);
- @Select("SELECT * FROM wvp_media_server")
List 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 queryAllWithAssistPort();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordPlanMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordPlanMapper.java
index ae0649aa2..51f80aec5 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordPlanMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RecordPlanMapper.java
@@ -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(" ")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void add(RecordPlan plan);
- @Insert(" ")
void batchAddItem(@Param("planId") int planId, List planItemList);
- @Select("select * from wvp_record_plan where id = #{planId}")
RecordPlan get(@Param("planId") Integer planId);
- @Select(" ")
List 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 getItemList(@Param("planId") Integer planId);
- @Delete("DELETE FROM wvp_record_plan_item WHERE plan_id = #{planId}")
void cleanItems(@Param("planId") Integer planId);
- @Select(" ")
List queryRecordIng(@Param("week") int week, @Param("index") int index);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java
index 3df746960..f26cdcaf6 100755
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java
@@ -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 = {" "})
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 selectAll();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserApiKeyMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserApiKeyMapper.java
index 18539f1af..43b022790 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserApiKeyMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserApiKeyMapper.java
@@ -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 = {""})
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 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 getUserApiKeys();
- @Select("SELECT COUNT(0) FROM wvp_user_api_key WHERE api_key = #{apiKey}")
boolean isApiKeyExists(@Param("apiKey") String apiKey);
-
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
index 8bfeab789..1a0077c44 100755
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
@@ -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 = {" "})
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 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 getUsers();
- @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}")
int changePushKey(@Param("id") int id, @Param("pushKey") String pushKey);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java
index f43f1096e..02a40482d 100755
--- a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java
@@ -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 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 selectForPushingInMediaServer(@Param("mediaServerId") String mediaServerId, @Param("enable") boolean enable);
+ List 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 = "")
void deleteByList(List 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);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java
deleted file mode 100644
index 968a74b70..000000000
--- a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java
+++ /dev/null
@@ -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 params ){
- return getBaseSelectSql() + " WHERE st.id = " + params.get("id");
- }
-
- public String selectForPushingInMediaServer(Map params ){
- return getBaseSelectSql() + " WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc";
- }
-
- public String selectOneByAppAndStream(Map 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 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();
- }
-}
diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java
index dfdb34216..d0cf2e4ad 100755
--- a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java
@@ -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 = {" "})
int update(StreamPush streamPushItem);
- @Delete("DELETE FROM wvp_stream_push WHERE id=#{id}")
int del(@Param("id") int id);
- @Select(value = {" "})
List 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("")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int addAll(List 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 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 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("")
List getListFromRedis(List offlineStreams);
-
- @Select("SELECT CONCAT(app,stream) from wvp_stream_push")
List getAllAppAndStream();
- @Select("select count(1) from wvp_stream_push ")
int getAllCount();
- @Select(value = {" "})
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 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 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("")
List selectInSet(Set ids);
- @Delete("")
void batchDel(List streamPushList);
-
- @Update({""})
int batchUpdate(List streamPushItemForUpdate);
}
diff --git a/src/main/resources/mapper/gb28181/CommonGBChannelMapper.xml b/src/main/resources/mapper/gb28181/CommonGBChannelMapper.xml
new file mode 100644
index 000000000..36137f12b
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/CommonGBChannelMapper.xml
@@ -0,0 +1,739 @@
+
+
+
+
+ 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
+
+
+
+ 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
+
+
+
+
+
+ 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})
+
+
+
+
+
+ delete
+ from wvp_device_channel
+ where id = #{gbId}
+
+
+
+ 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 wvp_device_channel
+ SET gb_status = #{status}
+ WHERE id = #{gbId}
+
+
+
+
+ UPDATE wvp_device_channel SET gb_status = #{status} WHERE id = #{item.gbId}
+
+
+
+
+
+
+ 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
+
+ (#{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})
+
+
+
+
+
+ UPDATE wvp_device_channel SET gb_status = #{item.gbStatus} WHERE id = #{item.gbId}
+
+
+
+
+ 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}
+
+
+
+
+
+ delete from wvp_device_channel
+ where id in
+
+ #{item.gbId}
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET gb_civil_code = null, civil_code = null
+ WHERE gb_civil_code in
+ #{item.deviceId}
+
+
+
+ UPDATE wvp_device_channel
+ SET gb_civil_code = #{civilCode}
+ WHERE id in
+ #{item.gbId}
+
+
+
+
+
+ UPDATE wvp_device_channel SET gb_civil_code = null, civil_code = null WHERE id in
+ #{item.gbId}
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null
+ WHERE id in
+ #{item.gbId}
+
+
+
+
+
+
+
+ UPDATE wvp_device_channel SET gb_business_group_id = #{businessGroup} WHERE id in
+ #{item.gbId}
+
+
+
+ UPDATE wvp_device_channel SET gb_parent_id = #{parentId} WHERE id in
+ #{item.gbId}
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}
+ WHERE id in
+ #{item.gbId}
+
+
+
+
+ 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}
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET gb_civil_code = #{civilCode}
+ WHERE id in
+ #{item.gbId}
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude}
+ WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId}
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET record_plan_id = null
+ WHERE id in
+ #{item}
+
+
+
+ UPDATE wvp_device_channel
+ SET record_plan_id = #{planId}
+ WHERE id in
+ #{item}
+
+
+
+ UPDATE wvp_device_channel
+ SET record_plan_id = #{planId}
+
+
+
+ UPDATE wvp_device_channel
+ SET record_plan_id = null
+ WHERE record_plan_id = #{planId}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/DeviceAlarmMapper.xml b/src/main/resources/mapper/gb28181/DeviceAlarmMapper.xml
new file mode 100644
index 000000000..99a55d0a4
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/DeviceAlarmMapper.xml
@@ -0,0 +1,36 @@
+
+
+
+
+ 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})
+
+
+
+
+
+ DELETE FROM wvp_device_alarm
+
+
+ AND device_id in
+ #{item}
+
+ AND alarm_time <= #{time}
+ AND id = #{id}
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/DeviceChannelMapper.xml b/src/main/resources/mapper/gb28181/DeviceChannelMapper.xml
new file mode 100644
index 000000000..c13f659bb
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/DeviceChannelMapper.xml
@@ -0,0 +1,786 @@
+
+
+
+
+ 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
+
+
+ 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})
+
+
+
+ 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}
+
+
+
+
+
+
+
+
+
+ DELETE
+ FROM wvp_device_channel
+ WHERE data_type = 1
+ and data_device_id = #{dataDeviceId}
+
+
+
+ DELETE
+ FROM wvp_device_channel
+ WHERE id = #{id}
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET stream_id=#{streamId}
+ WHERE id = #{channelId}
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET status='OFF'
+ WHERE id = #{id}
+
+
+
+ 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
+
+ (#{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})
+
+
+
+
+ UPDATE wvp_device_channel
+ SET status='ON'
+ WHERE id = #{id}
+
+
+
+
+ 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}
+
+
+
+
+
+ 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}
+
+
+
+
+ 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 wvp_device_channel
+ SET latitude=#{latitude},
+ longitude=#{longitude},
+ gps_time=#{gpsTime}
+ WHERE id = #{id}
+
+
+
+
+
+
+
+
+ DELETE FROM wvp_device_channel WHERE id=#{item.id}
+
+
+
+
+
+ UPDATE wvp_device_channel SET status=#{item.status} WHERE data_type = #{item.dataType}
+ and device_id=#{item.deviceId}
+
+
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET stream_identification=#{streamIdentification}
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_device_channel
+ SET stream_identification=#{streamIdentification}
+
+
+
+
+ UPDATE
+ wvp_device_channel
+ SET update_time=#{item.updateTime}
+ , longitude=#{item.longitude}
+ , latitude=#{item.latitude}
+ , gps_time=#{item.gpsTime}
+
+
+ and id=#{item.id}
+
+
+ and data_type = #{item.dataType}
+ and data_device_id=#{item.dataDeviceId}
+ AND device_id=#{item.deviceId}
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_device_channel
+ SET stream_id=null
+ WHERE id = #{channelId}
+
+
+
+ UPDATE wvp_device_channel
+ SET has_audio=#{audio}
+ WHERE id = #{channelId}
+
+
+
+
+ UPDATE wvp_device_channel SET gb_longitude = #{item.lng}, gb_latitude=#{item.lat}
+ WHERE id = #{item.channelId}
+
+
+
+
+ UPDATE wvp_device_channel
+ SET status=#{status}
+ WHERE data_type = #{dataType}
+ and data_device_id = #{dataDeviceId}
+ AND device_id = #{deviceId}
+
+
+ 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}
+
+
+
+
+
diff --git a/src/main/resources/mapper/gb28181/DeviceMapper.xml b/src/main/resources/mapper/gb28181/DeviceMapper.xml
new file mode 100644
index 000000000..f1078aa66
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/DeviceMapper.xml
@@ -0,0 +1,365 @@
+
+
+
+
+
+
+
+ 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})
+
+
+
+ UPDATE wvp_device
+ SET update_time=#{updateTime}
+ , name=#{name}
+ , manufacturer=#{manufacturer}
+ , model=#{model}
+ , firmware=#{firmware}
+ , transport=#{transport}
+ , ip=#{ip}
+ , local_ip=#{localIp}
+ , port=#{port}
+ , host_address=#{hostAddress}
+ , on_line=#{onLine}
+ , register_time=#{registerTime}
+ , keepalive_time=#{keepaliveTime}
+ , keepalive_interval_time=#{keepaliveIntervalTime}
+ , expires=#{expires}
+ WHERE device_id=#{deviceId}
+
+
+
+
+
+ DELETE
+ FROM wvp_device
+ WHERE device_id = #{deviceId}
+
+
+
+
+
+
+
+ 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}
+
+
+
+ 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})
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_device
+ SET subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_device
+ SET subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition},
+ mobile_position_submission_interval=#{mobilePositionSubmissionInterval}
+ WHERE id = #{id}
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/DeviceMobilePositionMapper.xml b/src/main/resources/mapper/gb28181/DeviceMobilePositionMapper.xml
new file mode 100644
index 000000000..427080846
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/DeviceMobilePositionMapper.xml
@@ -0,0 +1,43 @@
+
+
+
+
+ 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})
+
+
+
+
+
+
+ DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}
+
+
+
+
+ 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})
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/GroupMapper.xml b/src/main/resources/mapper/gb28181/GroupMapper.xml
new file mode 100644
index 000000000..43849f275
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/GroupMapper.xml
@@ -0,0 +1,275 @@
+
+
+
+
+ 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 INTO wvp_common_group (device_id, name, business_group, create_time, update_time, civil_code)
+ VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})
+
+
+
+ DELETE
+ FROM wvp_common_group
+ WHERE id = #{id}
+
+
+
+ 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}
+
+
+
+
+
+
+
+
+
+ INSERT INTO wvp_common_group (
+ device_id,
+ name,
+ parent_device_id,
+ parent_id,
+ business_group,
+ create_time,
+ civil_code,
+ update_time)
+ VALUES
+
+ (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId},
+ #{item.businessGroup},#{item.createTime},#{item.civilCode},#{item.updateTime})
+
+
+
+
+
+
+
+
+
+
+
+
+ DELETE FROM wvp_common_group WHERE id in
+ #{item.id}
+
+
+
+
+
+
+
+ DELETE
+ FROM wvp_common_group
+ WHERE business_group = #{businessGroup}
+
+
+
+ UPDATE wvp_common_group
+ SET parent_device_id=#{group.deviceId},
+ business_group = #{group.businessGroup}
+ WHERE parent_id = #{parentId}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+
+
+ DELETE
+ FROM wvp_platform_group
+ WHERE group_id = #{groupId}
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/PlatformChannelMapper.xml b/src/main/resources/mapper/gb28181/PlatformChannelMapper.xml
new file mode 100644
index 000000000..9543fd607
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/PlatformChannelMapper.xml
@@ -0,0 +1,549 @@
+
+
+
+
+
+ INSERT INTO wvp_platform_channel (platform_id, device_channel_id) VALUES
+
+ (#{platformId}, #{item.gbId})
+
+
+
+
+ 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 from wvp_platform_channel WHERE platform_id=#{platformId}
+ AND device_channel_id in
+
+ #{item.gbId}
+
+
+
+
+
+ DELETE from wvp_platform_channel WHERE
+ AND device_channel_id in
+
+ #{item.gbId}
+
+
+
+
+
+ INSERT INTO wvp_platform_group (platform_id, group_id) VALUES
+
+ (#{platformId}, #{item.id})
+
+
+
+
+ INSERT INTO wvp_platform_region (platform_id, region_id) VALUES
+
+ (#{platformId}, #{item.id})
+
+
+
+
+ DELETE from wvp_platform_group WHERE platform_id=#{platformId} AND group_id in
+ #{item.id}
+
+
+
+ DELETE
+ from wvp_platform_group
+ WHERE platform_id = #{platformId}
+ AND group_id = #{id}
+
+
+
+ DELETE
+ from wvp_platform_region
+ WHERE platform_id = #{platformId}
+ AND region_id = #{id}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DELETE
+ from wvp_platform_channel
+ WHERE platform_id = #{platformId}
+
+
+
+ DELETE
+ from wvp_platform_group
+ WHERE platform_id = #{platformId}
+
+
+
+ DELETE
+ from wvp_platform_region
+ WHERE platform_id = #{platformId}
+
+
+
+ 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}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/PlatformMapper.xml b/src/main/resources/mapper/gb28181/PlatformMapper.xml
new file mode 100644
index 000000000..ca3b63b83
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/PlatformMapper.xml
@@ -0,0 +1,114 @@
+
+
+
+
+ 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})
+
+
+
+ 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}
+
+
+
+ DELETE
+ FROM wvp_platform
+ WHERE id = #{id}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_platform
+ SET status=#{online}
+ WHERE server_gb_id = #{platformGbID}
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/gb28181/RegionMapper.xml b/src/main/resources/mapper/gb28181/RegionMapper.xml
new file mode 100644
index 000000000..db483f922
--- /dev/null
+++ b/src/main/resources/mapper/gb28181/RegionMapper.xml
@@ -0,0 +1,168 @@
+
+
+
+
+ INSERT INTO wvp_common_region (device_id, name, parent_id, parent_device_id, create_time, update_time)
+ VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{createTime}, #{updateTime})
+
+
+
+ DELETE
+ FROM wvp_common_region
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_common_region
+ SET update_time=#{updateTime},
+ device_id=#{deviceId},
+ name=#{name},
+ parent_id=#{parentId},
+ parent_device_id=#{parentDeviceId}
+ WHERE id = #{id}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ INSERT INTO wvp_common_region (
+ device_id,
+ name,
+ parent_device_id,
+ parent_id,
+ create_time,
+ update_time)
+ VALUES
+
+ (#{item.deviceId}, #{item.name},
+ #{item.parentDeviceId},#{item.parentId},#{item.createTime},#{item.updateTime})
+
+
+
+
+
+
+ DELETE FROM wvp_common_region WHERE id in
+ #{item.id}
+
+
+
+
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+ 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
+ #{item.id}
+
+
+
+ update wvp_common_region
+ set parent_device_id = #{parentDeviceId}
+ where parent_id = #{parentId}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/storager/CloudRecordServiceMapper.xml b/src/main/resources/mapper/storager/CloudRecordServiceMapper.xml
new file mode 100644
index 000000000..13c0a3b1d
--- /dev/null
+++ b/src/main/resources/mapper/storager/CloudRecordServiceMapper.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ INSERT INTO wvp_cloud_record (
+ app,
+ stream,
+ call_id,
+ start_time,
+ end_time,
+ media_server_id,
+ file_name,
+ folder,
+ file_path,
+ file_size,
+ time_len)
+ VALUES (
+ #{app},
+ #{stream},
+ #{callId},
+ #{startTime},
+ #{endTime},
+ #{mediaServerId},
+ #{fileName},
+ #{folder},
+ #{filePath},
+ #{fileSize},
+ #{timeLen})
+
+
+
+
+
+
+ update wvp_cloud_record set collect = #{collect} where file_path in
+
+ #{item.filePath}
+
+
+
+
+ delete from wvp_cloud_record where media_server_id=#{mediaServerId} and file_path in
+ #{item}
+
+
+
+
+
+ update wvp_cloud_record
+ set collect = #{collect}
+ where id = #{recordId}
+
+
+
+ delete from wvp_cloud_record where id in
+ #{item.id}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/storager/MediaServerMapper.xml b/src/main/resources/mapper/storager/MediaServerMapper.xml
new file mode 100644
index 000000000..8d01f4dd3
--- /dev/null
+++ b/src/main/resources/mapper/storager/MediaServerMapper.xml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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})
+
+
+ UPDATE wvp_media_server
+ SET update_time=#{updateTime}
+ , ip=#{ip}
+ , hook_ip=#{hookIp}
+ , sdp_ip=#{sdpIp}
+ , stream_ip=#{streamIp}
+ , http_port=#{httpPort}
+ , http_ssl_port=#{httpSSlPort}
+ , rtmp_port=#{rtmpPort}
+ , rtmp_ssl_port=#{rtmpSSlPort}
+ , rtp_proxy_port=#{rtpProxyPort}
+ , rtsp_port=#{rtspPort}
+ , rtsp_ssl_port=#{rtspSSLPort}
+ , flv_port=#{flvPort}
+ , flv_ssl_port=#{flvSSLPort}
+ , ws_flv_port=#{wsFlvPort}
+ , ws_flv_ssl_port=#{wsFlvSSLPort}
+ , auto_config=#{autoConfig}
+ , rtp_enable=#{rtpEnable}
+ , rtp_port_range=#{rtpPortRange}
+ , send_rtp_port_range=#{sendRtpPortRange}
+ , secret=#{secret}
+ , record_assist_port=#{recordAssistPort}
+ , hook_alive_interval=#{hookAliveInterval}
+ , record_day=#{recordDay}
+ , record_path=#{recordPath}
+ , transcode_suffix=#{transcodeSuffix}
+ , type=#{type}
+ WHERE id=#{id}
+
+
+
+ UPDATE wvp_media_server
+ SET update_time=#{updateTime}
+ , id=#{id}
+ , hook_ip=#{hookIp}
+ , sdp_ip=#{sdpIp}
+ , stream_ip=#{streamIp}
+ , http_ssl_port=#{httpSSlPort}
+ , rtmp_port=#{rtmpPort}
+ , rtmp_ssl_port=#{rtmpSSlPort}
+ , rtp_proxy_port=#{rtpProxyPort}
+ , rtsp_port=#{rtspPort}
+ , rtsp_ssl_port=#{rtspSSLPort}
+ , flv_port=#{flvPort}
+ , flv_ssl_port=#{flvSSLPort}
+ , ws_flv_port=#{wsFlvPort}
+ , ws_flv_ssl_port=#{wsFlvSSLPort}
+ , auto_config=#{autoConfig}
+ , rtp_enable=#{rtpEnable}
+ , rtp_port_range=#{rtpPortRange}
+ , send_rtp_port_range=#{sendRtpPortRange}
+ , secret=#{secret}
+ , record_assist_port=#{recordAssistPort}
+ , record_day=#{recordDay}
+ , record_path=#{recordPath}
+ , type=#{type}
+ , transcode_suffix=#{transcodeSuffix}
+ , hook_alive_interval=#{hookAliveInterval}
+ WHERE ip=#{ip} and http_port=#{httpPort}
+
+
+
+
+
+
+
+ DELETE
+ FROM wvp_media_server
+ WHERE id = #{id}
+
+
+
+ DELETE
+ FROM wvp_media_server
+ WHERE ip = #{host}
+ and http_port = #{port}
+
+
+
+ DELETE
+ FROM wvp_media_server
+ WHERE default_server = true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/storager/RecordPlanMapper.xml b/src/main/resources/mapper/storager/RecordPlanMapper.xml
new file mode 100644
index 000000000..a5527749f
--- /dev/null
+++ b/src/main/resources/mapper/storager/RecordPlanMapper.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ INSERT INTO wvp_record_plan(name, snap, create_time, update_time)
+ VALUES (#{name}, #{snap}, #{createTime}, #{updateTime})
+
+
+
+ INSERT INTO wvp_record_plan_item (
+ start,
+ stop,
+ week_day,
+ plan_id)
+ VALUES
+
+ (#{item.start}, #{item.stop}, #{item.weekDay},#{planId})
+
+
+
+
+
+
+
+
+ UPDATE wvp_record_plan
+ SET update_time=#{updateTime},
+ name=#{name},
+ snap=#{snap}
+ WHERE id = #{id}
+
+
+
+ DELETE
+ FROM wvp_record_plan
+ WHERE id = #{planId}
+
+
+
+ DELETE
+ FROM wvp_record_plan_item
+ WHERE plan_id = #{planId}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/storager/RoleMapper.xml b/src/main/resources/mapper/storager/RoleMapper.xml
new file mode 100644
index 000000000..f140f5ffc
--- /dev/null
+++ b/src/main/resources/mapper/storager/RoleMapper.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+ INSERT INTO wvp_user_role (name, authority, create_time, update_time)
+ VALUES (#{name}, #{authority}, #{createTime}, #{updateTime})
+
+
+
+ UPDATE wvp_user_role
+ SET update_time=#{updateTime}
+ , name=#{name}
+ , authority=#{authority}
+ WHERE id != 1 and id=#{id}
+
+
+
+ DELETE
+ from wvp_user_role
+ WHERE id != 1
+ and id = #{id}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/storager/UserApiKeyMapper.xml b/src/main/resources/mapper/storager/UserApiKeyMapper.xml
new file mode 100644
index 000000000..65b5bf386
--- /dev/null
+++ b/src/main/resources/mapper/storager/UserApiKeyMapper.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+ 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})
+
+
+
+ UPDATE wvp_user_api_key
+ SET update_time = #{updateTime}
+ , app = #{app}
+ , api_key = #{apiKey}
+ , expired_at = #{expiredAt}
+ , username = #{remark}
+ , enable = #{enable}
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_user_api_key
+ SET enable = true
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_user_api_key
+ SET enable = false
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_user_api_key
+ SET api_key = #{apiKey}
+ WHERE id = #{id}
+
+
+
+
+
+ DELETE
+ FROM wvp_user_api_key
+ WHERE id = #{id}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/storager/UserMapper.xml b/src/main/resources/mapper/storager/UserMapper.xml
new file mode 100644
index 000000000..dbea6333d
--- /dev/null
+++ b/src/main/resources/mapper/storager/UserMapper.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ INSERT INTO wvp_user (username, password, role_id, push_key, create_time, update_time)
+ VALUES (#{username}, #{password}, #{role.id}, #{pushKey}, #{createTime}, #{updateTime})
+
+
+
+ UPDATE wvp_user
+ SET update_time=#{updateTime}
+ , push_key=#{pushKey}
+ , role_id=#{role.id}
+ , password=#{password}
+ , username=#{username}
+ WHERE id=#{id}
+
+
+
+ DELETE
+ from wvp_user
+ WHERE id != 1
+ and id = #{id}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE wvp_user
+ set push_key=#{pushKey}
+ where id = #{id}
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/stream/StreamProxyMapper.xml b/src/main/resources/mapper/stream/StreamProxyMapper.xml
new file mode 100644
index 000000000..aa3dff45e
--- /dev/null
+++ b/src/main/resources/mapper/stream/StreamProxyMapper.xml
@@ -0,0 +1,142 @@
+
+
+
+
+ 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
+
+
+
+ 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})
+
+
+
+ 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}
+
+
+
+ DELETE
+ FROM wvp_stream_proxy
+ WHERE app = #{app}
+ AND stream = #{stream}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DELETE
+ FROM wvp_stream_proxy
+ WHERE id = #{id}
+
+
+
+ DELETE FROM wvp_stream_proxy WHERE id in
+
+ #{item.id}
+
+
+
+
+ UPDATE wvp_stream_proxy
+ SET pulling = true
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_stream_proxy
+ SET pulling = false
+ WHERE id = #{id}
+
+
+
+
+
+ UPDATE wvp_stream_proxy
+ SET pulling= false,
+ media_server_id = null,
+ stream_key = null
+ WHERE id = #{id}
+
+
+
+ UPDATE wvp_stream_proxy
+ SET pulling=#{pulling},
+ media_server_id = #{mediaServerId},
+ stream_key = #{streamKey}
+ WHERE id = #{id}
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/stream/StreamPushMapper.xml b/src/main/resources/mapper/stream/StreamPushMapper.xml
new file mode 100644
index 000000000..b59db7165
--- /dev/null
+++ b/src/main/resources/mapper/stream/StreamPushMapper.xml
@@ -0,0 +1,169 @@
+
+
+
+
+ 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})
+
+
+
+ UPDATE wvp_stream_push
+
+ update_time=#{updateTime},
+ app=#{app},
+ stream=#{stream},
+ media_server_id=#{mediaServerId},
+ server_id=#{serverId},
+ push_time=#{pushTime},
+ pushing=#{pushing},
+ start_offline_push=#{startOfflinePush},
+
+ WHERE id = #{id}
+
+
+
+ DELETE
+ FROM wvp_stream_push
+ WHERE id = #{id}
+
+
+
+
+
+
+
+ Insert INTO wvp_stream_push
+ (app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push)
+ VALUES
+
+ ( #{item.app}, #{item.stream}, #{item.mediaServerId},#{item.serverId} ,#{item.pushTime}, #{item.updateTime},
+ #{item.createTime}, #{item.pushing}, #{item.startOfflinePush})
+
+
+
+
+
+
+
+
+ UPDATE wvp_stream_push
+ SET pushing=#{pushing}
+ WHERE id = #{id}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DELETE FROM wvp_stream_push WHERE id in
+
+ #{item.id}
+
+
+
+
+
+ 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}
+
+
+
\ No newline at end of file