refactor(video): projectId 两级隔离适配 + SQL 融合到 video.sql

SQL 融合:
- sql/mysql/video.sql 作为最终主脚本(26 张表),整合用户改造版表前缀 video_
  与 cherry-pick 版的框架字段(tenant_id/creator/updater/deleted/datetime)
- 新增 video_ai_camera_snapshot(AI 抓拍)、video_common_gb_channel(国标通道抽象)
- 删除旧的 aiot-video.sql(被 video.sql 替代)
- 17 张业务表 + 6 张 AI 业务表加 project_id 列(项目级隔离)
- 2 张字典表(video_ai_algorithm/video_ai_algo_template)仅租户级
- video_media_server 全局共享,无多租户字段

代码改造:
- 21 个 DO 的 @TableName 从 wvp_* 改为 video_*
- 16 个业务 DO 改继承 ProjectBaseDO(StreamProxy/StreamPush 通过
  CommonGBChannel 自动获得),字典 DO 保留 TenantBaseDO,
  MediaServer 保留 BaseDO
- 28 个 Mapper/Provider 的 SQL 表名全部更新为 video_*
- application.yaml 新增 tenant.ignore-project-tables 配置,
  列出 video_media_server/video_ai_algorithm/video_ai_algo_template
  不参与项目隔离
- 编译通过(mvn compile BUILD SUCCESS)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
lzh
2026-04-21 11:10:27 +08:00
parent fe5bbbe8c6
commit 43becf998c
51 changed files with 1067 additions and 968 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.aiot.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_alert")
@TableName("video_ai_alert")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "AI告警记录")
public class AiAlert extends TenantBaseDO {
public class AiAlert extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -9,7 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_algo_template")
@TableName("video_ai_algo_template")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "算法参数模板")
public class AiAlgoTemplate extends TenantBaseDO {

View File

@@ -9,7 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_algorithm")
@TableName("video_ai_algorithm")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "算法注册表")
public class AiAlgorithm extends TenantBaseDO {

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.aiot.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_config_log")
@TableName("video_ai_config_log")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "配置变更日志")
public class AiConfigLog extends TenantBaseDO {
public class AiConfigLog extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.aiot.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_config_snapshot")
@TableName("video_ai_config_snapshot")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "配置版本快照")
public class AiConfigSnapshot extends TenantBaseDO {
public class AiConfigSnapshot extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.aiot.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_edge_device")
@TableName("video_ai_edge_device")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "边缘设备状态")
public class AiEdgeDevice extends TenantBaseDO {
public class AiEdgeDevice extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.aiot.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_roi")
@TableName("video_ai_roi")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "ROI区域配置")
public class AiRoi extends TenantBaseDO {
public class AiRoi extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.aiot.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_ai_roi_algo_bind")
@TableName("video_ai_roi_algo_bind")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "ROI算法绑定")
public class AiRoiAlgoBind extends TenantBaseDO {
public class AiRoiAlgoBind extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -15,14 +15,14 @@ import java.util.List;
@Mapper
public interface AiAlertMapper extends BaseMapperX<AiAlert> {
@Select("SELECT COUNT(1) FROM wvp_ai_alert WHERE alert_id=#{alertId} AND deleted=0")
@Select("SELECT COUNT(1) FROM video_ai_alert WHERE alert_id=#{alertId} AND deleted=0")
int countByAlertId(@Param("alertId") String alertId);
@Select("SELECT a.*, r.name AS roi_name, " +
"COALESCE(sp.name, sp.app) AS camera_name " +
"FROM wvp_ai_alert a " +
"LEFT JOIN wvp_ai_roi r ON a.roi_id = r.roi_id " +
"LEFT JOIN wvp_stream_proxy sp ON a.camera_id = sp.camera_code " +
"FROM video_ai_alert a " +
"LEFT JOIN video_ai_roi r ON a.roi_id = r.roi_id " +
"LEFT JOIN video_stream_proxy sp ON a.camera_id = sp.camera_code " +
"WHERE a.alert_id=#{alertId} AND a.deleted=0")
@Results({
@Result(property = "roiName", column = "roi_name"),
@@ -33,9 +33,9 @@ public interface AiAlertMapper extends BaseMapperX<AiAlert> {
@Select(value = {"<script>" +
"SELECT a.*, r.name AS roi_name, " +
"COALESCE(sp.name, sp.app) AS camera_name " +
"FROM wvp_ai_alert a " +
"LEFT JOIN wvp_ai_roi r ON a.roi_id = r.roi_id " +
"LEFT JOIN wvp_stream_proxy sp ON a.camera_id = sp.camera_code " +
"FROM video_ai_alert a " +
"LEFT JOIN video_ai_roi r ON a.roi_id = r.roi_id " +
"LEFT JOIN video_stream_proxy sp ON a.camera_id = sp.camera_code " +
"WHERE a.deleted=0 " +
"<if test='cameraId != null'> AND a.camera_id=#{cameraId}</if> " +
"<if test='alertType != null'> AND a.alert_type=#{alertType}</if> " +
@@ -53,14 +53,14 @@ public interface AiAlertMapper extends BaseMapperX<AiAlert> {
@Param("startTime") String startTime,
@Param("endTime") String endTime);
@Select("SELECT alert_type, COUNT(*) as cnt FROM wvp_ai_alert " +
@Select("SELECT alert_type, COUNT(*) as cnt FROM video_ai_alert " +
"WHERE received_at >= #{startTime} AND deleted=0 GROUP BY alert_type")
List<java.util.Map<String, Object>> statisticsByType(@Param("startTime") String startTime);
@Select("SELECT camera_id, COUNT(*) as cnt FROM wvp_ai_alert " +
@Select("SELECT camera_id, COUNT(*) as cnt FROM video_ai_alert " +
"WHERE received_at >= #{startTime} AND deleted=0 GROUP BY camera_id ORDER BY cnt DESC")
List<java.util.Map<String, Object>> statisticsByCamera(@Param("startTime") String startTime);
@Update("UPDATE wvp_ai_alert SET duration_minutes=#{durationMinutes} WHERE alert_id=#{alertId} AND deleted=0")
@Update("UPDATE video_ai_alert SET duration_minutes=#{durationMinutes} WHERE alert_id=#{alertId} AND deleted=0")
int updateDuration(@Param("alertId") String alertId, @Param("durationMinutes") double durationMinutes);
}

View File

@@ -30,7 +30,7 @@ public interface AiAlgoTemplateMapper extends BaseMapperX<AiAlgoTemplate> {
}
@Select(value = {"<script>" +
"SELECT * FROM wvp_ai_algo_template WHERE deleted=0 " +
"SELECT * FROM video_ai_algo_template WHERE deleted=0 " +
"<if test='algoCode != null'> AND algo_code=#{algoCode}</if> " +
"ORDER BY id DESC" +
"</script>"})

View File

@@ -39,6 +39,6 @@ public interface AiAlgorithmMapper extends BaseMapperX<AiAlgorithm> {
.eq(AiAlgorithm::getAlgoCode, algorithm.getAlgoCode()));
}
@Update("UPDATE wvp_ai_algorithm SET is_active=#{isActive}, update_time=#{updateTime} WHERE id=#{id} AND deleted=0")
@Update("UPDATE video_ai_algorithm SET is_active=#{isActive}, update_time=#{updateTime} WHERE id=#{id} AND deleted=0")
int updateActive(@Param("id") Long id, @Param("isActive") Integer isActive, @Param("updateTime") String updateTime);
}

View File

@@ -5,10 +5,10 @@ import org.apache.ibatis.annotations.*;
@Mapper
public interface AiCameraSnapshotMapper {
@Select("SELECT cos_key FROM wvp_ai_camera_snapshot WHERE camera_code = #{cameraCode}")
@Select("SELECT cos_key FROM video_ai_camera_snapshot WHERE camera_code = #{cameraCode}")
String getCosKey(@Param("cameraCode") String cameraCode);
@Insert("INSERT INTO wvp_ai_camera_snapshot (camera_code, cos_key) " +
@Insert("INSERT INTO video_ai_camera_snapshot (camera_code, cos_key) " +
"VALUES (#{cameraCode}, #{cosKey}) " +
"ON DUPLICATE KEY UPDATE cos_key = #{cosKey}, updated_at = NOW()")
int upsert(@Param("cameraCode") String cameraCode, @Param("cosKey") String cosKey);

View File

@@ -17,7 +17,7 @@ public interface AiConfigLogMapper extends BaseMapperX<AiConfigLog> {
}
@Select(value = {"<script>" +
"SELECT * FROM wvp_ai_config_log WHERE deleted=0 " +
"SELECT * FROM video_ai_config_log WHERE deleted=0 " +
"<if test='configType != null'> AND config_type=#{configType}</if> " +
"<if test='configId != null'> AND config_id=#{configId}</if> " +
"ORDER BY id DESC" +

View File

@@ -20,18 +20,18 @@ public interface AiConfigSnapshotMapper extends BaseMapperX<AiConfigSnapshot> {
return selectById(id);
}
@Select("SELECT COALESCE(MAX(version), 0) FROM wvp_ai_config_snapshot " +
@Select("SELECT COALESCE(MAX(version), 0) FROM video_ai_config_snapshot " +
"WHERE scope_type=#{scopeType} AND scope_id=#{scopeId} AND deleted=0")
int getMaxVersion(@Param("scopeType") String scopeType, @Param("scopeId") String scopeId);
@Select("SELECT * FROM wvp_ai_config_snapshot " +
@Select("SELECT * FROM video_ai_config_snapshot " +
"WHERE scope_type=#{scopeType} AND scope_id=#{scopeId} AND version=#{version} AND deleted=0")
AiConfigSnapshot queryByVersion(@Param("scopeType") String scopeType,
@Param("scopeId") String scopeId,
@Param("version") Integer version);
@Select(value = {"<script>" +
"SELECT * FROM wvp_ai_config_snapshot WHERE deleted=0 " +
"SELECT * FROM video_ai_config_snapshot WHERE deleted=0 " +
"<if test='scopeType != null'> AND scope_type=#{scopeType}</if> " +
"<if test='scopeId != null'> AND scope_id=#{scopeId}</if> " +
"<if test='cameraId != null'> AND camera_id=#{cameraId}</if> " +

View File

@@ -31,30 +31,30 @@ public interface AiEdgeDeviceMapper extends BaseMapperX<AiEdgeDevice> {
return selectList(new LambdaQueryWrapper<AiEdgeDevice>().orderByDesc(AiEdgeDevice::getUpdatedAt));
}
@Update("UPDATE wvp_ai_edge_device SET status='offline', updated_at=#{now} " +
@Update("UPDATE video_ai_edge_device SET status='offline', updated_at=#{now} " +
"WHERE status='online' AND last_heartbeat < #{threshold} AND deleted=0")
int markOffline(@Param("threshold") String threshold, @Param("now") String now);
@Update("UPDATE wvp_ai_edge_device SET deleted=1 WHERE device_id != #{keepDeviceId} AND deleted=0")
@Update("UPDATE video_ai_edge_device SET deleted=1 WHERE device_id != #{keepDeviceId} AND deleted=0")
int deleteAllExcept(@Param("keepDeviceId") String keepDeviceId);
@Update("UPDATE wvp_ai_edge_device SET device_id=#{newDeviceId} WHERE id=#{id} AND deleted=0")
@Update("UPDATE video_ai_edge_device SET device_id=#{newDeviceId} WHERE id=#{id} AND deleted=0")
int renameDeviceId(@Param("id") Long id, @Param("newDeviceId") String newDeviceId);
@Update("UPDATE wvp_ai_edge_device SET device_id=#{newDeviceId} WHERE device_id=#{oldDeviceId} AND deleted=0")
@Update("UPDATE video_ai_edge_device SET device_id=#{newDeviceId} WHERE device_id=#{oldDeviceId} AND deleted=0")
int renameByDeviceId(@Param("oldDeviceId") String oldDeviceId, @Param("newDeviceId") String newDeviceId);
@Select({"<script>" +
"SELECT * FROM wvp_ai_edge_device " +
"SELECT * FROM video_ai_edge_device " +
"WHERE deleted=0 " +
"<if test='status != null'> AND status=#{status}</if> " +
"ORDER BY updated_at DESC" +
"</script>"})
IPage<AiEdgeDevice> queryPage(IPage<AiEdgeDevice> page, @Param("status") String status);
@Select("SELECT COUNT(*) FROM wvp_ai_edge_device WHERE status=#{status} AND deleted=0")
@Select("SELECT COUNT(*) FROM video_ai_edge_device WHERE status=#{status} AND deleted=0")
int countByStatus(@Param("status") String status);
@Select("SELECT COUNT(*) FROM wvp_ai_edge_device WHERE deleted=0")
@Select("SELECT COUNT(*) FROM video_ai_edge_device WHERE deleted=0")
int countAll();
}

View File

@@ -29,22 +29,22 @@ public interface AiRoiAlgoBindMapper extends BaseMapperX<AiRoiAlgoBind> {
return delete(AiRoiAlgoBind::getRoiId, roiId);
}
@Select("SELECT * FROM wvp_ai_roi_algo_bind WHERE roi_id=#{roiId} AND deleted=0 ORDER BY priority DESC, id")
@Select("SELECT * FROM video_ai_roi_algo_bind WHERE roi_id=#{roiId} AND deleted=0 ORDER BY priority DESC, id")
List<AiRoiAlgoBind> queryByRoiId(@Param("roiId") String roiId);
default AiRoiAlgoBind queryByBindId(String bindId) {
return selectOne(AiRoiAlgoBind::getBindId, bindId);
}
@Select("SELECT * FROM wvp_ai_roi_algo_bind WHERE roi_id=#{roiId} AND algo_code=#{algoCode} AND deleted=0")
@Select("SELECT * FROM video_ai_roi_algo_bind WHERE roi_id=#{roiId} AND algo_code=#{algoCode} AND deleted=0")
AiRoiAlgoBind queryByRoiIdAndAlgoCode(@Param("roiId") String roiId, @Param("algoCode") String algoCode);
default List<AiRoiAlgoBind> queryByTemplateId(String templateId) {
return selectList(AiRoiAlgoBind::getTemplateId, templateId);
}
@Select("SELECT b.* FROM wvp_ai_roi_algo_bind b " +
"INNER JOIN wvp_ai_roi r ON b.roi_id = r.roi_id " +
@Select("SELECT b.* FROM video_ai_roi_algo_bind b " +
"INNER JOIN video_ai_roi r ON b.roi_id = r.roi_id " +
"WHERE r.camera_id=#{cameraId} AND b.deleted=0 AND r.deleted=0 ORDER BY b.priority DESC, b.id")
List<AiRoiAlgoBind> queryByCameraId(@Param("cameraId") String cameraId);

View File

@@ -36,7 +36,7 @@ public interface AiRoiMapper extends BaseMapperX<AiRoi> {
}
@Select(value = {"<script>" +
"SELECT * FROM wvp_ai_roi WHERE deleted=0 " +
"SELECT * FROM video_ai_roi WHERE deleted=0 " +
"<if test='cameraId != null'> AND camera_id=#{cameraId}</if> " +
"<if test='deviceId != null'> AND device_id=#{deviceId}</if> " +
"<if test='query != null'> AND (name LIKE concat('%',#{query},'%') OR camera_id LIKE concat('%',#{query},'%'))</if> " +
@@ -47,37 +47,37 @@ public interface AiRoiMapper extends BaseMapperX<AiRoi> {
@Param("deviceId") String deviceId,
@Param("query") String query);
@Select("SELECT * FROM wvp_ai_roi WHERE camera_id=#{cameraId} AND enabled=1 AND deleted=0 ORDER BY priority DESC")
@Select("SELECT * FROM video_ai_roi WHERE camera_id=#{cameraId} AND enabled=1 AND deleted=0 ORDER BY priority DESC")
List<AiRoi> queryByCameraId(@Param("cameraId") String cameraId);
@Select("SELECT * FROM wvp_ai_roi WHERE camera_id=#{cameraId} AND deleted=0 ORDER BY priority DESC")
@Select("SELECT * FROM video_ai_roi WHERE camera_id=#{cameraId} AND deleted=0 ORDER BY priority DESC")
List<AiRoi> queryAllByCameraId(@Param("cameraId") String cameraId);
default List<AiRoi> queryAll() {
return selectList(new LambdaQueryWrapper<AiRoi>().orderByDesc(AiRoi::getPriority).orderByDesc(AiRoi::getId));
}
@Select("SELECT DISTINCT camera_id FROM wvp_ai_roi WHERE device_id=#{deviceId} AND deleted=0")
@Select("SELECT DISTINCT camera_id FROM video_ai_roi WHERE device_id=#{deviceId} AND deleted=0")
List<String> queryDistinctCameraIdsByDeviceId(@Param("deviceId") String deviceId);
@Select("SELECT DISTINCT device_id FROM wvp_ai_roi WHERE camera_id=#{cameraId} AND device_id IS NOT NULL AND deleted=0 LIMIT 1")
@Select("SELECT DISTINCT device_id FROM video_ai_roi WHERE camera_id=#{cameraId} AND device_id IS NOT NULL AND deleted=0 LIMIT 1")
String queryDeviceIdByCameraId(@Param("cameraId") String cameraId);
@Update("UPDATE wvp_ai_roi SET device_id=#{deviceId} WHERE (device_id IS NULL OR device_id='') AND deleted=0")
@Update("UPDATE video_ai_roi SET device_id=#{deviceId} WHERE (device_id IS NULL OR device_id='') AND deleted=0")
int backfillDeviceId(@Param("deviceId") String deviceId);
@Update("UPDATE wvp_ai_roi SET device_id=#{deviceId} WHERE deleted=0")
@Update("UPDATE video_ai_roi SET device_id=#{deviceId} WHERE deleted=0")
int updateAllDeviceId(@Param("deviceId") String deviceId);
/**
* 将 ROI 表中 camera_id 从 app/stream 格式更新为 camera_code
*/
@Update("UPDATE wvp_ai_roi SET camera_id = #{cameraCode} WHERE camera_id = #{oldCameraId} AND deleted=0")
@Update("UPDATE video_ai_roi SET camera_id = #{cameraCode} WHERE camera_id = #{oldCameraId} AND deleted=0")
int updateCameraId(@Param("oldCameraId") String oldCameraId, @Param("cameraCode") String cameraCode);
/**
* 查询使用非 camera_code 格式的 ROI即 camera_id 不以 cam_ 开头的记录)
*/
@Select("SELECT * FROM wvp_ai_roi WHERE camera_id NOT LIKE 'cam_%' AND deleted=0")
@Select("SELECT * FROM video_ai_roi WHERE camera_id NOT LIKE 'cam_%' AND deleted=0")
List<AiRoi> queryWithLegacyCameraId();
}

View File

@@ -211,7 +211,7 @@ public class AiConfigServiceImpl implements IAiConfigService {
// 1. 构建完整配置JSON
Map<String, Object> config = exportConfig(cameraId);
// 2. 保存快照到 wvp_ai_config_snapshot (版本化)
// 2. 保存快照到 video_ai_config_snapshot (版本化)
AiConfigSnapshot snapshot = snapshotService.createSnapshot(
"CAMERA", cameraId, cameraId,
JSON.toJSONString(config),

View File

@@ -494,7 +494,7 @@ public class AiRedisConfigServiceImpl implements IAiRedisConfigService {
if (proxy == null) {
log.warn("[AiRedis] 摄像头 {} 在 stream_proxy 表中未找到camera_code 不匹配),跳过。" +
"请确认该摄像头的 camera_code 已正确写入 wvp_stream_proxy 表", cameraId);
"请确认该摄像头的 camera_code 已正确写入 video_stream_proxy 表", cameraId);
continue;
}

View File

@@ -3,17 +3,17 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import com.viewsh.module.video.gb28181.event.subscribe.catalog.CatalogEvent;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_device_channel")
@TableName("video_device_channel")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "国标通道")
public class CommonGBChannel extends TenantBaseDO {
public class CommonGBChannel extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "国标-数据库自增ID")

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -13,10 +13,10 @@ import lombok.EqualsAndHashCode;
* @author lin
*/
@Data
@TableName("wvp_device")
@TableName("video_device")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "国标设备/平台")
public class Device extends TenantBaseDO {
public class Device extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库自增ID")

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -16,9 +16,9 @@ import java.util.Set;
*/
@Schema(description = "报警信息")
@Data
@TableName("wvp_device_alarm")
@TableName("video_device_alarm")
@EqualsAndHashCode(callSuper = true)
public class DeviceAlarm extends TenantBaseDO {
public class DeviceAlarm extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "数据库id")

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -13,10 +13,10 @@ import org.jetbrains.annotations.NotNull;
* 业务分组
*/
@Data
@TableName("wvp_common_group")
@TableName("video_common_group")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "业务分组")
public class Group extends TenantBaseDO implements Comparable<Group>{
public class Group extends ProjectBaseDO implements Comparable<Group>{
/**
* 数据库自增ID
*/

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -14,9 +14,9 @@ import lombok.EqualsAndHashCode;
*/
@Data
@TableName("wvp_device_mobile_position")
@TableName("video_device_mobile_position")
@EqualsAndHashCode(callSuper = true)
public class MobilePosition extends TenantBaseDO {
public class MobilePosition extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
private Long id;

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -12,10 +12,10 @@ import lombok.EqualsAndHashCode;
* @author lin
*/
@Data
@TableName("wvp_platform")
@TableName("video_platform")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "平台信息")
public class Platform extends TenantBaseDO {
public class Platform extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "ID(数据库中)")

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.gb28181.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import com.viewsh.module.video.common.CivilCodePo;
import com.viewsh.module.video.utils.CivilCodeUtil;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -15,10 +15,10 @@ import org.jetbrains.annotations.NotNull;
* 区域
*/
@Data
@TableName("wvp_common_region")
@TableName("video_common_region")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "区域")
public class Region extends TenantBaseDO implements Comparable<Region>{
public class Region extends ProjectBaseDO implements Comparable<Region>{
/**
* 数据库自增ID
*/

View File

@@ -26,7 +26,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<CommonGBChannel> queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
@Insert(" <script>" +
"INSERT INTO wvp_device_channel (" +
"INSERT INTO video_device_channel (" +
"gb_device_id," +
"data_type," +
"data_device_id," +
@@ -119,7 +119,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
}
@Update(value = {" <script>" +
"UPDATE wvp_device_channel " +
"UPDATE video_device_channel " +
"SET update_time=#{updateTime}" +
"<if test='gbDeviceId != null' > , gb_device_id = #{gbDeviceId}</if> " +
"<if test='gbName != null' > , gb_name = #{gbName}</if> " +
@@ -160,7 +160,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
int update(CommonGBChannel commonGBChannel);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_status = #{status}" +
" WHERE id = #{gbId}"+
" </script>"})
@@ -168,7 +168,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Update("<script> " +
"<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
"UPDATE wvp_device_channel SET gb_status = #{status} WHERE id = #{item.gbId}" +
"UPDATE video_device_channel SET gb_status = #{status} WHERE id = #{item.gbId}" +
"</foreach> " +
"</script>")
int updateStatusForListById(List<CommonGBChannel> commonGBChannels, @Param("status") String status);
@@ -178,7 +178,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Insert(" <script>" +
"INSERT INTO wvp_device_channel (" +
"INSERT INTO video_device_channel (" +
"gb_device_id," +
"data_type, " +
"data_device_id," +
@@ -233,13 +233,13 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Update("<script> " +
"<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
"UPDATE wvp_device_channel SET gb_status = #{item.gbStatus} WHERE id = #{item.gbId}" +
"UPDATE video_device_channel SET gb_status = #{item.gbStatus} WHERE id = #{item.gbId}" +
"</foreach> " +
"</script>")
int updateStatus(List<CommonGBChannel> commonGBChannels);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET update_time=#{updateTime}" +
"<foreach collection='fields' index='index' item='item'> " +
" ,${item} = null" +
@@ -280,13 +280,13 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
" coalesce(gb_status, status) as status, " +
" 1 as type, " +
" true as is_leaf " +
" from wvp_device_channel " +
" from video_device_channel " +
" where coalesce(gb_civil_code, civil_code) = #{parentDeviceId} " +
" </script>")
List<RegionTree> queryForRegionTreeByCivilCode(@Param("parentDeviceId") String parentDeviceId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_civil_code = null, civil_code = null" +
" WHERE gb_civil_code in "+
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
@@ -295,7 +295,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_civil_code = #{civilCode}" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -306,7 +306,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<CommonGBChannel> queryByIdsOrCivilCode(@Param("civilCode") String civilCode, @Param("ids") List<Long> ids);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_civil_code = null, civil_code = null" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -314,7 +314,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
int removeCivilCodeByChannels(List<CommonGBChannel> channelList);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_civil_code = null, civil_code = null" +
" WHERE id in "+
" <foreach collection='channelIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
@@ -331,7 +331,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<CommonGBChannel> queryByGbDeviceIds(List<String> deviceIds);
@Select(value = {" <script>" +
" select id from wvp_device_channel " +
" select id from video_device_channel " +
" where channel_type = 0 and data_type = #{dataType} and data_device_id in "+
" <foreach collection='deviceIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>"})
@@ -341,7 +341,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<CommonGBChannel> queryByGroupList(List<Group> groupList);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -355,7 +355,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<CommonGBChannel> queryByParentId(@Param("parentId") String parentId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_business_group_id = #{businessGroup}" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -363,7 +363,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
int updateBusinessGroupByChannelList(@Param("businessGroup") String businessGroup, List<CommonGBChannel> channelList);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_parent_id = #{parentId}" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -381,7 +381,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
" coalesce(gb_status, status) as status, " +
" 1 as type, " +
" true as is_leaf " +
" from wvp_device_channel " +
" from video_device_channel " +
" where channel_type = 0 and coalesce(gb_parent_id, parent_id) = #{parent} " +
" <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
@@ -389,7 +389,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -400,7 +400,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Update({"<script>" +
"<foreach collection='commonGBChannels' item='item' separator=';'>" +
" UPDATE" +
" wvp_device_channel" +
" video_device_channel" +
" SET update_time=#{item.updateTime}" +
", gb_device_id=#{item.gbDeviceId}" +
", gb_name=#{item.gbName}" +
@@ -450,7 +450,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<CommonGBChannel> queryShareChannelByCivilCode(@Param("civilCode") String civilCode, @Param("platformId") Long platformId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_civil_code = #{civilCode}" +
" WHERE id in "+
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@@ -462,7 +462,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Update(value = {" <script>" +
" <foreach collection='gpsMsgInfoList' item='item' separator=';' >" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_longitude=#{item.lng}" +
", gb_latitude=#{item.lat} " +
", gps_speed=#{item.speed} " +
@@ -485,7 +485,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Param("civilCode") String civilCode, @Param("parentDeviceId") String parentDeviceId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET record_plan_id = null" +
" WHERE id in "+
" <foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
@@ -493,7 +493,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
void removeRecordPlan(List<Long> channelIds);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET record_plan_id = #{planId}" +
" WHERE id in "+
" <foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
@@ -501,13 +501,13 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
void addRecordPlan(List<Long> channelIds, @Param("planId") Long planId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET record_plan_id = #{planId}" +
" </script>"})
void addRecordPlanForAll(@Param("planId") Long planId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET record_plan_id = null" +
" WHERE record_plan_id = #{planId} "+
" </script>"})
@@ -557,7 +557,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
" coalesce( wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce( wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce( wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode \n" +
" from wvp_device_channel wdc" +
" from video_device_channel wdc" +
" where wdc.channel_type = 0 " +
" <if test='query != null'> " +
" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') escape '/' " +
@@ -588,7 +588,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
List<Long> queryAllForUnusualParent();
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null" +
" WHERE id in "+
" <foreach collection='channelIdsForClear' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
@@ -602,12 +602,12 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@SelectProvider(type = ChannelProvider.class, method = "queryCommonChannelByDeviceChannel")
CommonGBChannel queryCommonChannelByDeviceChannel(@Param("dataType") Integer dataType, @Param("dataDeviceId") Long dataDeviceId, @Param("deviceId") String deviceId);
@Update("UPDATE wvp_device_channel SET stream_id = #{stream} where id = #{gbId}")
@Update("UPDATE video_device_channel SET stream_id = #{stream} where id = #{gbId}")
void updateStream(Long gbId, String stream);
@Update("<script> " +
"<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
"UPDATE wvp_device_channel " +
"UPDATE video_device_channel " +
" SET gb_longitude=#{item.gbLongitude}" +
", gb_latitude=#{item.gbLatitude} " +
", gps_speed=#{item.gpsSpeed} " +
@@ -662,7 +662,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@Update("<script> " +
"<foreach collection='channels' index='index' item='item' separator=';'> " +
"UPDATE wvp_device_channel SET map_level=#{item.mapLevel} " +
"UPDATE video_device_channel SET map_level=#{item.mapLevel} " +
"WHERE id = #{item.gbId}" +
"</foreach> " +
"</script>")
@@ -677,7 +677,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
@SelectProvider(type = ChannelProvider.class, method = "queryMeetingChannelList")
List<CameraChannel> queryMeetingChannelList(@Param("business") String business);
@Update("UPDATE wvp_device_channel SET map_level=null")
@Update("UPDATE video_device_channel SET map_level=null")
int resetLevel();
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelInBox")
@@ -689,7 +689,7 @@ public interface CommonGBChannelMapper extends BaseMapperX<CommonGBChannel> {
"MIN(coalesce(gb_longitude, longitude)) as minLng, " +
"MAX(coalesce(gb_latitude, latitude)) as maxLat, " +
"MIN(coalesce(gb_latitude, latitude)) as minLat " +
" from wvp_device_channel " +
" from video_device_channel " +
" where channel_type = 0")
Extent queryExtent();

View File

@@ -19,13 +19,13 @@ import java.util.List;
@Repository
public interface DeviceAlarmMapper extends BaseMapperX<DeviceAlarm> {
@Insert("INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " +
@Insert("INSERT INTO video_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " +
"VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})")
int add(DeviceAlarm alarm);
@Select( value = {" <script>" +
" SELECT * FROM wvp_device_alarm " +
" SELECT * FROM video_device_alarm " +
" WHERE 1=1 " +
" <if test=\"deviceId != null\" > AND device_id = #{deviceId}</if>" +
" <if test=\"channelId != null\" > AND channel_id = #{channelId}</if>" +
@@ -41,7 +41,7 @@ public interface DeviceAlarmMapper extends BaseMapperX<DeviceAlarm> {
@Update(" <script>" +
"UPDATE wvp_device_alarm SET deleted = 1 WHERE 1=1 " +
"UPDATE video_device_alarm SET deleted = 1 WHERE 1=1 " +
" <if test=\"deviceIdList != null and id == null \" > AND device_id in " +
"<foreach collection='deviceIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
"</if>" +

View File

@@ -22,7 +22,7 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
@Insert("<script> " +
"insert into wvp_device_channel " +
"insert into video_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, " +
@@ -39,7 +39,7 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
int add(DeviceChannel channel);
@Update(value = {" <script>" +
"UPDATE wvp_device_channel " +
"UPDATE video_device_channel " +
"SET update_time=#{updateTime}" +
", device_id=#{deviceId}" +
", data_type=#{dataType}" +
@@ -98,7 +98,7 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("dataDeviceId") Long dataDeviceId);
@Select("<script> " +
"select id from wvp_device_channel where data_type =1 and data_device_id in " +
"select id from video_device_channel where data_type =1 and data_device_id in " +
" <foreach item='item' index='index' collection='deviceDbIds' open='(' separator=',' close=')'> #{item} </foreach>" +
" </script>")
List<Long> queryChaneIdListByDeviceDbIds(List<Long> deviceDbIds);
@@ -151,8 +151,8 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" coalesce(dc.gb_latitude, dc.latitude) as latitude,\n" +
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id " +
" from " +
" wvp_device_channel dc " +
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
" video_device_channel dc " +
" LEFT JOIN video_device de ON dc.data_device_id = de.id " +
" WHERE dc.data_type = 1 " +
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
@@ -168,7 +168,7 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" </script>"})
List<DeviceChannelExtend> queryChannelsWithDeviceInfo( @Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"})
@Update(value = {"UPDATE video_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"})
void startPlay(@Param("channelId") Long channelId, @Param("streamId") String streamId);
@@ -182,9 +182,9 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" dc.sub_count,\n" +
" pgc.platform_id as platform_id,\n" +
" pgc.catalog_id as catalog_id " +
" FROM wvp_device_channel dc " +
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
" LEFT JOIN wvp_platform_channel pgc on pgc.device_channel_id = dc.id " +
" FROM video_device_channel dc " +
" LEFT JOIN video_device de ON dc.data_device_id = de.id " +
" LEFT JOIN video_platform_channel pgc on pgc.device_channel_id = dc.id " +
" WHERE dc.data_type = 1 " +
" <if test='query != null'> " +
"AND " +
@@ -194,18 +194,18 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" <if test='online == false' > AND dc.status='OFF'</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.sub_count > 0</if> " +
" <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.sub_count = 0</if> " +
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_channel where platform_id=#{platformId} ) </if> " +
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from video_platform_channel where platform_id=#{platformId} ) </if> " +
" <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
" ORDER BY COALESCE(dc.gb_device_id, dc.device_id) ASC" +
" </script>"})
List<ChannelReduce> queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Update(value = {"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{id}"})
@Update(value = {"UPDATE video_device_channel SET status='OFF' WHERE id=#{id}"})
void offline(@Param("id") Long id);
@Insert("<script> " +
"insert into wvp_device_channel " +
"insert into video_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, " +
@@ -223,13 +223,13 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
@Update(value = {"UPDATE wvp_device_channel SET status='ON' WHERE id=#{id}"})
@Update(value = {"UPDATE video_device_channel SET status='ON' WHERE id=#{id}"})
void online(@Param("id") Long id);
@Update({"<script>" +
"<foreach collection='updateChannels' item='item' separator=';'>" +
" UPDATE" +
" wvp_device_channel" +
" video_device_channel" +
" SET update_time=#{item.updateTime}" +
", device_id=#{item.deviceId}" +
", data_type=#{item.dataType}" +
@@ -279,7 +279,7 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
int batchUpdate(List<DeviceChannel> updateChannels);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
" UPDATE video_device_channel " +
" SET " +
" latitude=#{latitude}, " +
" longitude=#{longitude}, " +
@@ -335,10 +335,10 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" 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}")
" from video_device_channel where data_type = 1 and data_device_id = #{dataDeviceId}")
List<DeviceChannel> queryAllChannelsForRefresh(@Param("dataDeviceId") Long 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}")
@Select("select de.* from video_device de left join video_device_channel dc on de.device_id = dc.device_id where dc.data_type = 1 and dc.device_id=#{channelId}")
List<Device> getDeviceByChannelDeviceId(@Param("channelId") String channelId);
@@ -350,31 +350,31 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status=#{item.status} WHERE data_type = #{item.dataType} and device_id=#{item.deviceId}" +
"UPDATE video_device_channel SET status=#{item.status} WHERE data_type = #{item.dataType} and device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchUpdateStatus(List<DeviceChannel> channels);
@Select("select count(1) from wvp_device_channel where status = 'ON'")
@Select("select count(1) from video_device_channel where status = 'ON'")
int getOnlineCount();
@Select("select count(1) from wvp_device_channel")
@Select("select count(1) from video_device_channel")
int getAllChannelCount();
@Update("<script>" +
"UPDATE wvp_device_channel SET stream_identification=#{streamIdentification} WHERE id=#{id}" +
"UPDATE video_device_channel SET stream_identification=#{streamIdentification} WHERE id=#{id}" +
"</script>")
void updateChannelStreamIdentification(DeviceChannel channel);
@Update("<script>" +
"UPDATE wvp_device_channel SET stream_identification=#{streamIdentification}" +
"UPDATE video_device_channel SET stream_identification=#{streamIdentification}" +
"</script>")
void updateAllChannelStreamIdentification(@Param("streamIdentification") String streamIdentification);
@Update({"<script>" +
"<foreach collection='channelList' item='item' separator=';'>" +
" UPDATE" +
" wvp_device_channel" +
" video_device_channel" +
" SET update_time=#{item.updateTime}" +
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
@@ -436,7 +436,7 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" download_speed,\n" +
" svc_space_support_mod,\n" +
" svc_time_support_mode\n" +
" from wvp_device_channel " +
" from video_device_channel " +
" where id=#{id}" +
" </script>"})
DeviceChannel getOneForSource(@Param("id") Long id);
@@ -493,29 +493,29 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" download_speed,\n" +
" svc_space_support_mod,\n" +
" svc_time_support_mode\n" +
" from wvp_device_channel " +
" from video_device_channel " +
" where data_type = 1 and data_device_id=#{dataDeviceId} and coalesce(gb_device_id, device_id) = #{channelId}" +
" </script>"})
DeviceChannel getOneByDeviceIdForSource(@Param("dataDeviceId") Long dataDeviceId, @Param("channelId") String channelId);
@Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE id=#{channelId}"})
@Update(value = {"UPDATE video_device_channel SET stream_id=null WHERE id=#{channelId}"})
void stopPlayById(@Param("channelId") Long channelId);
@Update(value = {" <script>" +
"UPDATE wvp_device_channel " +
"UPDATE video_device_channel " +
"SET has_audio=#{audio}" +
" WHERE id=#{channelId}" +
" </script>"})
void changeAudio(@Param("channelId") Long channelId, @Param("audio") boolean audio);
@Update("UPDATE wvp_device_channel SET status=#{status} WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}")
@Update("UPDATE video_device_channel SET status=#{status} WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void updateStatus(DeviceChannel channel);
@Update({"<script>" +
" UPDATE" +
" wvp_device_channel" +
" video_device_channel" +
" SET update_time=#{updateTime}" +
", device_id=#{deviceId}" +
", data_device_id=#{dataDeviceId}" +
@@ -611,12 +611,12 @@ public interface DeviceChannelMapper extends BaseMapperX<DeviceChannel> {
" download_speed,\n" +
" svc_space_support_mod,\n" +
" svc_time_support_mode\n" +
" from wvp_device_channel " +
" from video_device_channel " +
" where data_type = 1 and data_device_id=#{dataDeviceId} and device_id = #{channelId}" +
" </script>"})
DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") Long dataDeviceId, @Param("channelId") String channelId);
@Update(value = {"UPDATE wvp_device_channel SET status = 'OFF' WHERE data_type = 1 and data_device_id=#{deviceId}"})
@Update(value = {"UPDATE video_device_channel SET status = 'OFF' WHERE data_type = 1 and data_device_id=#{deviceId}"})
void offlineByDeviceId(@Param("deviceId") Long deviceId);

View File

@@ -48,11 +48,11 @@ public interface DeviceMapper extends BaseMapperX<Device> {
"server_id,"+
"media_server_id," +
"broadcast_push_after_ack," +
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = 1 and dc.data_device_id= de.id) as channel_count "+
" FROM wvp_device de WHERE de.device_id = #{deviceId}")
"(SELECT count(0) FROM video_device_channel dc WHERE dc.data_type = 1 and dc.data_device_id= de.id) as channel_count "+
" FROM video_device de WHERE de.device_id = #{deviceId}")
Device getDeviceByDeviceId( @Param("deviceId") String deviceId);
@Insert("INSERT INTO wvp_device (" +
@Insert("INSERT INTO video_device (" +
"device_id, " +
"name, " +
"manufacturer, " +
@@ -123,7 +123,7 @@ public interface DeviceMapper extends BaseMapperX<Device> {
int add(Device device);
@Update(value = {" <script>" +
"UPDATE wvp_device " +
"UPDATE video_device " +
"SET update_time=#{updateTime}" +
", name=#{name}" +
", manufacturer=#{manufacturer}" +
@@ -183,8 +183,8 @@ public interface DeviceMapper extends BaseMapperX<Device> {
"geo_coord_sys,"+
"on_line,"+
"media_server_id,"+
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
"FROM wvp_device de" +
"(SELECT count(0) FROM video_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
"FROM video_device de" +
"<if test='online != null'> where de.on_line=${online}</if>"+
" order by de.create_time desc "+
" </script>"
@@ -226,7 +226,7 @@ public interface DeviceMapper extends BaseMapperX<Device> {
"geo_coord_sys,"+
"server_id,"+
"on_line"+
" FROM wvp_device WHERE on_line = true")
" FROM video_device WHERE on_line = true")
List<Device> getOnlineDevices();
@Select("SELECT " +
@@ -261,7 +261,7 @@ public interface DeviceMapper extends BaseMapperX<Device> {
"geo_coord_sys,"+
"server_id,"+
"on_line"+
" FROM wvp_device WHERE on_line = true and server_id = #{serverId}")
" FROM video_device WHERE on_line = true and server_id = #{serverId}")
List<Device> getOnlineDevicesByServerId(@Param("serverId") String serverId);
@Select("SELECT " +
@@ -294,11 +294,11 @@ public interface DeviceMapper extends BaseMapperX<Device> {
"broadcast_push_after_ack,"+
"geo_coord_sys,"+
"on_line"+
" FROM wvp_device WHERE ip = #{host} AND port=#{port}")
" FROM video_device WHERE ip = #{host} AND port=#{port}")
Device getDeviceByHostAndPort(@Param("host") String host, @Param("port") int port);
@Update(value = {" <script>" +
"UPDATE wvp_device " +
"UPDATE video_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}" +
@@ -307,7 +307,7 @@ public interface DeviceMapper extends BaseMapperX<Device> {
" </script>"})
void updateCustom(Device device);
@Insert("INSERT INTO wvp_device (" +
@Insert("INSERT INTO video_device (" +
"device_id,"+
"custom_name,"+
"password,"+
@@ -342,10 +342,10 @@ public interface DeviceMapper extends BaseMapperX<Device> {
")")
void addCustomDevice(Device device);
@Select("select * FROM wvp_device")
@Select("select * FROM video_device")
List<Device> getAll();
@Select("select * FROM wvp_device where as_message_channel = true")
@Select("select * FROM video_device where as_message_channel = true")
List<Device> queryDeviceWithAsMessageChannel();
@Select(" <script>" +
@@ -384,8 +384,8 @@ public interface DeviceMapper extends BaseMapperX<Device> {
",position_capability" +
",broadcast_push_after_ack" +
",server_id" +
",(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
" FROM wvp_device de" +
",(SELECT count(0) FROM video_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
" FROM video_device de" +
" where 1 = 1 "+
" <if test='status != null'> AND de.on_line=${status}</if>"+
" <if test='query != null'> AND (" +
@@ -397,34 +397,34 @@ public interface DeviceMapper extends BaseMapperX<Device> {
" </script>")
IPage<Device> getDeviceList(IPage<Device> page, @Param("dataType") Integer dataType, @Param("query") String query, @Param("status") Boolean status);
@Select("select * from wvp_device_channel where id = #{id}")
@Select("select * from video_device_channel where id = #{id}")
DeviceChannel getRawChannel(@Param("id") Long id);
@Select("select * from wvp_device where id = #{id}")
@Select("select * from video_device where id = #{id}")
Device query(@Param("id") Long 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}")
@Select("select wd.* from video_device wd left join video_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") Long 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}")
@Select("select wd.* from video_device wd left join video_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.device_id = #{channelDeviceId}")
Device getDeviceBySourceChannelDeviceId(@Param("dataType") Integer dataType, @Param("channelDeviceId") String channelDeviceId);
@Update(value = {" <script>" +
" UPDATE wvp_device " +
" UPDATE video_device " +
" SET subscribe_cycle_for_catalog=#{subscribeCycleForCatalog}" +
" WHERE id=#{id}"+
" </script>"})
void updateSubscribeCatalog(Device device);
@Update(value = {" <script>" +
"UPDATE wvp_device " +
"UPDATE video_device " +
"SET subscribe_cycle_for_mobile_position=#{subscribeCycleForMobilePosition}, mobile_position_submission_interval=#{mobilePositionSubmissionInterval}" +
" WHERE id=#{id}"+
" </script>"})
void updateSubscribeMobilePosition(Device device);
@Update(value = {" <script>" +
"UPDATE wvp_device " +
"UPDATE video_device " +
"SET on_line=false" +
" WHERE id in"+
"<foreach collection='offlineDevices' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
@@ -435,7 +435,7 @@ public interface DeviceMapper extends BaseMapperX<Device> {
@Update({"<script>" +
"<foreach collection='devices' item='item' separator=';'>" +
" UPDATE" +
" wvp_device" +
" video_device" +
" SET update_time=#{item.updateTime}" +
", name=#{item.name}" +
", manufacturer=#{item.manufacturer}" +
@@ -500,7 +500,7 @@ public interface DeviceMapper extends BaseMapperX<Device> {
",position_capability" +
",broadcast_push_after_ack" +
",server_id" +
" FROM wvp_device" +
" FROM video_device" +
" WHERE device_id in"+
"<foreach collection='deviceIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>"})

View File

@@ -13,12 +13,12 @@ import java.util.List;
@Mapper
public interface DeviceMobilePositionMapper extends BaseMapperX<MobilePosition> {
@Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,create_time)"+
@Insert("INSERT INTO video_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,create_time)"+
"VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{createTime})")
int insertNewPosition(MobilePosition mobilePosition);
@Select(value = {" <script>" +
"SELECT * FROM wvp_device_mobile_position" +
"SELECT * FROM video_device_mobile_position" +
" WHERE device_id = #{deviceId}" +
"<if test=\"channelId != null\"> and channel_id = #{channelId}</if>" +
"<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
@@ -27,7 +27,7 @@ public interface DeviceMobilePositionMapper extends BaseMapperX<MobilePosition>
" </script>"})
List<MobilePosition> queryPositionByDeviceIdAndTime(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("startTime") String startTime, @Param("endTime") String endTime);
@Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" +
@Select("SELECT * FROM video_device_mobile_position WHERE device_id = #{deviceId}" +
" ORDER BY time DESC LIMIT 1")
MobilePosition queryLatestPositionByDevice(String deviceId);
@@ -37,7 +37,7 @@ public interface DeviceMobilePositionMapper extends BaseMapperX<MobilePosition>
@Insert("<script> " +
"<foreach collection='mobilePositions' index='index' item='item' separator=';'> " +
"insert into wvp_device_mobile_position " +
"insert into video_device_mobile_position " +
"(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," +
"create_time)"+
"values " +

View File

@@ -18,12 +18,12 @@ import java.util.Set;
@Mapper
public interface GroupMapper extends BaseMapperX<Group> {
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code, alias) " +
@Insert("INSERT INTO video_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code, alias) " +
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode}, #{alias})")
@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, alias) " +
@Insert("INSERT INTO video_common_group (device_id, name, business_group, create_time, update_time, civil_code, alias) " +
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode}, #{alias})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int addBusinessGroup(Group group);
@@ -32,7 +32,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
return deleteById(id);
}
@Update(" UPDATE wvp_common_group " +
@Update(" UPDATE video_common_group " +
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, " +
" parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}, civil_code=#{civilCode}, " +
" alias=#{alias}" +
@@ -40,22 +40,22 @@ public interface GroupMapper extends BaseMapperX<Group> {
int update(Group group);
@Select(value = {" <script>" +
"SELECT * from wvp_common_group WHERE 1=1 " +
"SELECT * from video_common_group WHERE 1=1 " +
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
" <if test='parentId != null and businessGroupId != null '> AND parent_device_id = #{parentId} AND business_group=#{businessGroup} </if> " +
"ORDER BY id " +
" </script>"})
IPage<Group> query(IPage<Group> page, @Param("query") String query, @Param("parentId") String parentId, @Param("businessGroup") String businessGroup);
@Select("SELECT * from wvp_common_group WHERE parent_id = #{parentId} ")
@Select("SELECT * from video_common_group WHERE parent_id = #{parentId} ")
List<Group> getChildren(@Param("parentId") Long parentId);
@Select("SELECT * from wvp_common_group WHERE id = #{id} ")
@Select("SELECT * from video_common_group WHERE id = #{id} ")
Group queryOne(@Param("id") Long id);
@Insert(" <script>" +
" INSERT INTO wvp_common_group (" +
" INSERT INTO video_common_group (" +
" device_id," +
" name, " +
" parent_device_id," +
@@ -81,7 +81,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
" 0 as type," +
" false as is_leaf," +
" 'ON' as status" +
" from wvp_common_group " +
" from video_common_group " +
" where 1=1 " +
" <if test='parentId != null'> and parent_id = #{parentId} </if> " +
" <if test='parentId == null'> and parent_id is null </if> " +
@@ -94,7 +94,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
" * , " +
" 0 as type," +
" false as is_leaf" +
" from wvp_common_group " +
" from video_common_group " +
" where parent_id is not null and business_group = #{businessGroup} and device_id != #{businessGroup}" +
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
" </script>")
@@ -106,16 +106,16 @@ public interface GroupMapper extends BaseMapperX<Group> {
" *," +
" 0 as type," +
" false as is_leaf" +
" from wvp_common_group " +
" from video_common_group " +
" where device_id=business_group" +
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
" </script>")
List<GroupTree> queryBusinessGroupForTree(@Param("query") String query);
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId} and business_group = #{businessGroup}")
@Select("SELECT * from video_common_group WHERE device_id = #{deviceId} and business_group = #{businessGroup}")
Group queryOneByDeviceId(@Param("deviceId") String deviceId, @Param("businessGroup") String businessGroup);
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId}")
@Select("SELECT * from video_common_group WHERE device_id = #{deviceId}")
Group queryOneByOnlyDeviceId(@Param("deviceId") String deviceId);
default int batchDelete(List<Group> allChildren) {
@@ -124,13 +124,13 @@ public interface GroupMapper extends BaseMapperX<Group> {
return deleteBatch(Group::getId, ids);
}
@Select("SELECT * from wvp_common_group WHERE device_id = #{businessGroup} and business_group = #{businessGroup} ")
@Select("SELECT * from video_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} ")
@Select("SELECT * from video_common_group WHERE business_group = #{businessGroup} ")
List<Group> queryByBusinessGroup(@Param("businessGroup") String businessGroup);
@Select("SELECT * from wvp_common_group WHERE business_group = #{businessGroup}")
@Select("SELECT * from video_common_group WHERE business_group = #{businessGroup}")
@MapKey("id")
Map<Integer, CameraGroup> queryByBusinessGroupForMap(@Param("businessGroup") String businessGroup);
@@ -138,13 +138,13 @@ public interface GroupMapper extends BaseMapperX<Group> {
return delete(Group::getBusinessGroup, businessGroup);
}
@Update(" UPDATE wvp_common_group " +
@Update(" UPDATE video_common_group " +
" SET parent_device_id=#{group.deviceId}, business_group = #{group.businessGroup}" +
" WHERE parent_id = #{parentId}")
int updateChild(@Param("parentId") Long parentId, Group group);
@Select(" <script>" +
" SELECT * from wvp_common_group " +
" SELECT * from video_common_group " +
" where device_id in " +
" <foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
" </script>")
@@ -153,7 +153,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
@Select(" <script>" +
" SELECT " +
" * " +
" from wvp_common_group " +
" from video_common_group " +
" where (device_id, business_group) in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > (#{item.gbParentId}, #{item.gbBusinessGroupId})</foreach>" +
" </script>")
@@ -162,7 +162,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
@Select(" <script>" +
" SELECT " +
" * " +
" from wvp_common_group " +
" from video_common_group " +
" where id in " +
" <foreach collection='groupSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
" </script>")
@@ -176,16 +176,16 @@ public interface GroupMapper extends BaseMapperX<Group> {
" 1 as gb_parental," +
" wcg.parent_device_id as gb_parent_id," +
" wcg.civil_code as gb_civil_code" +
" from wvp_common_group wcg" +
" left join wvp_platform_group wpg on wpg.group_id = wcg.id" +
" from video_common_group wcg" +
" left join video_platform_group wpg on wpg.group_id = wcg.id" +
" where wpg.platform_id = #{platformId} " +
" </script>")
List<CommonGBChannel> queryForPlatform(@Param("platformId") Long platformId);
@Select(" <script>" +
" SELECT * " +
" from wvp_common_group wcg" +
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" from video_common_group wcg" +
" left join video_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" where wpg.platform_id is null and wcg.device_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbParentId}</foreach>" +
" </script>")
@@ -193,8 +193,8 @@ public interface GroupMapper extends BaseMapperX<Group> {
@Select(" <script>" +
" SELECT * " +
" from wvp_common_group wcg" +
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" from video_common_group wcg" +
" left join video_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" where wpg.platform_id IS NULL and wcg.id in " +
" <foreach collection='allGroup' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>")
@@ -204,7 +204,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
@Select(" <script>" +
" SELECT " +
" * " +
" from wvp_common_group " +
" from video_common_group " +
" where device_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbParentId}</foreach>" +
" order by id " +
@@ -212,31 +212,31 @@ public interface GroupMapper extends BaseMapperX<Group> {
Set<Group> queryByChannelList(List<CommonGBChannel> channelList);
@Update(value = " <script>" +
" update wvp_common_group w1 " +
" inner join (select * from wvp_common_group ) w2 on w1.parent_device_id = w2.device_id " +
" update video_common_group w1 " +
" inner join (select * from video_common_group ) w2 on w1.parent_device_id = w2.device_id " +
" set w1.parent_id = w2.id" +
" where w1.id in " +
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "mysql")
@Update(value = " <script>" +
" update wvp_common_group w1 " +
" inner join (select * from wvp_common_group ) w2 on w1.parent_device_id = w2.device_id " +
" update video_common_group w1 " +
" inner join (select * from video_common_group ) w2 on w1.parent_device_id = w2.device_id " +
" set w1.parent_id = w2.id" +
" where w1.id in " +
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "h2")
@Update( value = " <script>" +
" update wvp_common_group w1\n" +
" update video_common_group w1\n" +
" set parent_id = w2.id\n" +
" from wvp_common_group w2\n" +
" from video_common_group w2\n" +
" where w1.parent_device_id = w2.device_id\n" +
" and w1.id in " +
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "postgresql")
@Update( value = " <script>" +
" update wvp_common_group w1\n" +
" update video_common_group w1\n" +
" set parent_id = w2.id\n" +
" from wvp_common_group w2\n" +
" from video_common_group w2\n" +
" where w1.parent_device_id = w2.device_id\n" +
" and w1.id in " +
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
@@ -244,8 +244,8 @@ public interface GroupMapper extends BaseMapperX<Group> {
void updateParentId(List<Group> groupListForAdd);
@Update(value = " <script>" +
" update wvp_common_group w1 " +
" inner join (select * from wvp_common_group ) w2" +
" update video_common_group w1 " +
" inner join (select * from video_common_group ) w2" +
" on w1.parent_device_id is null" +
" and w2.parent_device_id is null" +
" and w2.device_id = w2.business_group " +
@@ -256,8 +256,8 @@ public interface GroupMapper extends BaseMapperX<Group> {
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "mysql")
@Update(value = " <script>" +
" update wvp_common_group w1 " +
" inner join (select * from wvp_common_group ) w2" +
" update video_common_group w1 " +
" inner join (select * from video_common_group ) w2" +
" on w1.parent_device_id is null" +
" and w2.parent_device_id is null" +
" and w2.device_id = w2.business_group " +
@@ -268,9 +268,9 @@ public interface GroupMapper extends BaseMapperX<Group> {
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "h2")
@Update( value = " <script>" +
" update wvp_common_group w1 " +
" update video_common_group w1 " +
" set parent_id = w2.id " +
" from wvp_common_group w2 " +
" from video_common_group w2 " +
" where w1.parent_device_id is null " +
" and w2.parent_device_id is null " +
" and w2.device_id = w2.business_group " +
@@ -280,9 +280,9 @@ public interface GroupMapper extends BaseMapperX<Group> {
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "kingbase")
@Update( value = " <script>" +
" update wvp_common_group w1 " +
" update video_common_group w1 " +
" set parent_id = w2.id " +
" from wvp_common_group w2 " +
" from video_common_group w2 " +
" where w1.parent_device_id is null " +
" and w2.parent_device_id is null " +
" and w2.device_id = w2.business_group " +
@@ -296,19 +296,19 @@ public interface GroupMapper extends BaseMapperX<Group> {
@Select(" <script>" +
" SELECT " +
" wp.* " +
" from wvp_platform_group wpg " +
" left join wvp_platform wp on wp.id = wpg.platform_id " +
" from video_platform_group wpg " +
" left join video_platform wp on wp.id = wpg.platform_id " +
" where wpg.group_id = #{groupId} " +
"</script>")
List<Platform> queryForPlatformByGroupId(@Param("groupId") Long groupId);
@Update("UPDATE wvp_platform_group SET deleted = 1 WHERE group_id = #{groupId}")
@Update("UPDATE video_platform_group SET deleted = 1 WHERE group_id = #{groupId}")
void deletePlatformGroup(@Param("groupId") Long groupId);
@Select("SELECT * from wvp_common_group WHERE alias = #{alias} ")
@Select("SELECT * from video_common_group WHERE alias = #{alias} ")
CameraGroup queryGroupByAlias(@Param("alias") String alias);
@Select("SELECT * from wvp_common_group WHERE alias = #{alias} and business_group = #{businessGroup}")
@Select("SELECT * from video_common_group WHERE alias = #{alias} and business_group = #{businessGroup}")
Group queryGroupByAliasAndBusinessGroup(@Param("alias") String alias, @Param("deviceId") String businessGroup);
@@ -318,7 +318,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
" COUNT(*) AS allCount," +
" SUM(CASE WHEN coalesce( wdc.gb_status, wdc.status) = 'ON' THEN 1 ELSE 0 END) AS onlineCount" +
" FROM " +
" wvp_device_channel wdc " +
" video_device_channel wdc " +
" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
" AND coalesce( wdc.gb_parent_id, wdc.parent_id) in " +
" <foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
@@ -326,7 +326,7 @@ public interface GroupMapper extends BaseMapperX<Group> {
"</script>")
List<CameraCount> queryCountWithChild(List<CameraGroup> groupList);
@Select("SELECT * from wvp_common_group where alias is not null")
@Select("SELECT * from video_common_group where alias is not null")
@MapKey("alias")
Map<String, Group> queryGroupByAliasMap();
@@ -334,24 +334,24 @@ public interface GroupMapper extends BaseMapperX<Group> {
delete(new LambdaQueryWrapperX<Group>().isNotNull(Group::getAlias));
}
@Update(value = " UPDATE wvp_common_group g1" +
" JOIN wvp_common_group g2" +
@Update(value = " UPDATE video_common_group g1" +
" JOIN video_common_group g2" +
" ON g1.parent_device_id = g2.device_id" +
" SET g1.parent_id = g2.id" +
" WHERE g1.alias IS NOT NULL;", databaseId = "mysql")
@Update(value = " UPDATE wvp_common_group g1" +
" JOIN wvp_common_group g2" +
@Update(value = " UPDATE video_common_group g1" +
" JOIN video_common_group g2" +
" ON g1.parent_device_id = g2.device_id" +
" SET g1.parent_id = g2.id" +
" WHERE g1.alias IS NOT NULL;", databaseId = "h2")
@Update(value = " UPDATE wvp_common_group AS g1" +
@Update(value = " UPDATE video_common_group AS g1" +
" SET parent_id = g2.id" +
" FROM wvp_common_group AS g2" +
" FROM video_common_group AS g2" +
" WHERE g1.parent_device_id = g2.device_id" +
" AND g1.alias IS NOT NULL;", databaseId = "kingbase")
@Update(value = " UPDATE wvp_common_group AS g1" +
@Update(value = " UPDATE video_common_group AS g1" +
" SET parent_id = g2.id" +
" FROM wvp_common_group AS g2" +
" FROM video_common_group AS g2" +
" WHERE g1.parent_device_id = g2.device_id" +
" AND g1.alias IS NOT NULL;", databaseId = "postgresql")
void fixParentId();

View File

@@ -16,7 +16,7 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
@Insert("<script> "+
"INSERT INTO wvp_platform_channel (platform_id, device_channel_id) VALUES" +
"INSERT INTO video_platform_channel (platform_id, device_channel_id) VALUES" +
"<foreach collection='channelList' item='item' separator=','>" +
" (#{platformId}, #{item.gbId} )" +
"</foreach>" +
@@ -24,18 +24,18 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
int addChannels(@Param("platformId") Long platformId, @Param("channelList") List<CommonGBChannel> channelList);
@Update("<script> "+
"UPDATE wvp_platform_channel SET deleted = 1 WHERE device_channel_id in " +
"UPDATE video_platform_channel SET deleted = 1 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} " +
"(select pgc.device_channel_id from video_platform_channel pgc " +
"left join video_device_channel dc on dc.id = pgc.device_channel_id where dc.channel_type = 0 and dc.device_id =#{deviceId} " +
") temp)" +
"</script>")
int delChannelForDeviceId(String deviceId);
@Select("select d.*\n" +
"from wvp_platform_channel pgc\n" +
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
" left join wvp_device d on dc.device_id = d.device_id\n" +
"from video_platform_channel pgc\n" +
" left join video_device_channel dc on dc.id = pgc.device_channel_id\n" +
" left join video_device d on dc.device_id = d.device_id\n" +
"where dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
@@ -43,8 +43,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" SELECT " +
" wp.* " +
" FROM " +
" wvp_platform wp " +
" left join wvp_platform_channel wpgc on " +
" video_platform wp " +
" left join video_platform_channel wpgc on " +
" wp.id = wpgc.platform_id " +
" WHERE " +
" wpgc.device_channel_id = #{channelId} and wp.status = true " +
@@ -54,15 +54,15 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
List<Platform> queryPlatFormListForGBWithGBId(@Param("channelId") Long channelId, List<String> platforms);
@Select("select dc.channel_id, dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
"from wvp_platform_channel pgc\n" +
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
" left join wvp_device d on dc.device_id = d.device_id\n" +
"from video_platform_channel pgc\n" +
" left join video_device_channel dc on dc.id = pgc.device_channel_id\n" +
" left join video_device d on dc.device_id = d.device_id\n" +
"where dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
@Select(" SELECT wp.* from wvp_platform_channel pgc " +
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id " +
" left join wvp_platform wp on wp.id = pgc.platform_id" +
@Select(" SELECT wp.* from video_platform_channel pgc " +
" left join video_device_channel dc on dc.id = pgc.device_channel_id " +
" left join video_platform wp on wp.id = pgc.platform_id" +
" WHERE dc.channel_type = 0 and dc.device_id=#{channelId}")
List<Platform> queryParentPlatformByChannelId(@Param("channelId") String channelId);
@@ -143,8 +143,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" coalesce( wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce( wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode, \n" +
" wpgc.platform_id " +
" from wvp_device_channel wdc" +
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
" from video_device_channel wdc" +
" left join video_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
" where wdc.channel_type = 0 " +
" <if test='query != null'> " +
" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') OR wpgc.custom_device_id LIKE concat('%',#{query},'%') " +
@@ -199,8 +199,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" 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" +
" from video_device_channel wdc" +
" left join video_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 "
)
@@ -248,8 +248,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" coalesce(wpgc.custom_download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wpgc.custom_svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel wdc" +
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
" from video_device_channel wdc" +
" left join video_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
" where wdc.channel_type = 0 and wpgc.platform_id is null" +
"<if test='channelIds != null'> AND wdc.id in " +
"<foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'> #{item} </foreach> " +
@@ -302,8 +302,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" 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" +
" from video_device_channel wdc" +
" left join video_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
" where wdc.channel_type = 0 and wpgc.platform_id = #{platformId}" +
"<if test='channelIds != null'> AND wdc.id in " +
" <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
@@ -315,7 +315,7 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
List<CommonGBChannel> queryShare(@Param("platformId") Long platformId, List<Long> channelIds);
@Update("<script> " +
"UPDATE wvp_platform_channel SET deleted = 1 WHERE platform_id=#{platformId} " +
"UPDATE video_platform_channel SET deleted = 1 WHERE platform_id=#{platformId} " +
"<if test='channelList != null'> AND device_channel_id in " +
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
" #{item.gbId} " +
@@ -325,7 +325,7 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
int removeChannelsWithPlatform(@Param("platformId") Long platformId, @Param("channelList") List<CommonGBChannel> channelList);
@Update("<script> " +
"UPDATE wvp_platform_channel SET deleted = 1 WHERE 1=1 " +
"UPDATE video_platform_channel SET deleted = 1 WHERE 1=1 " +
"<if test='channelList != null'> AND device_channel_id in " +
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
" #{item.gbId} " +
@@ -335,7 +335,7 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
int removeChannels(@Param("channelList") List<CommonGBChannel> channelList);
@Insert("<script> "+
"INSERT INTO wvp_platform_group (platform_id, group_id) VALUES " +
"INSERT INTO video_platform_group (platform_id, group_id) VALUES " +
"<foreach collection='groupListNotShare' item='item' separator=','>" +
" (#{platformId}, #{item.id} )" +
"</foreach>" +
@@ -343,7 +343,7 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
int addPlatformGroup(Collection<Group> groupListNotShare, @Param("platformId") Long platformId);
@Insert("<script> "+
"INSERT INTO wvp_platform_region (platform_id, region_id) VALUES " +
"INSERT INTO video_platform_region (platform_id, region_id) VALUES " +
"<foreach collection='regionListNotShare' item='item' separator=','>" +
" (#{platformId}, #{item.id} )" +
"</foreach>" +
@@ -351,37 +351,37 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
int addPlatformRegion(List<Region> regionListNotShare, @Param("platformId") Long platformId);
@Update("<script> "+
"UPDATE wvp_platform_group SET deleted = 1 WHERE platform_id=#{platformId} AND group_id in" +
"UPDATE video_platform_group SET deleted = 1 WHERE platform_id=#{platformId} AND group_id in" +
"<foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
"</script>")
int removePlatformGroup(@Param("groupList") List<Group> groupList, @Param("platformId") Long platformId);
@Update("UPDATE wvp_platform_group SET deleted = 1 WHERE platform_id=#{platformId} AND group_id = #{id}")
@Update("UPDATE video_platform_group SET deleted = 1 WHERE platform_id=#{platformId} AND group_id = #{id}")
void removePlatformGroupById(@Param("id") Long id, @Param("platformId") Long platformId);
@Update("UPDATE wvp_platform_region SET deleted = 1 WHERE platform_id=#{platformId} AND region_id = #{id}")
@Update("UPDATE video_platform_region SET deleted = 1 WHERE platform_id=#{platformId} AND region_id = #{id}")
void removePlatformRegionById(@Param("id") Long id, @Param("platformId") Long platformId);
@Select(" <script>" +
" SELECT wcg.* " +
" from wvp_common_group wcg" +
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" from video_common_group wcg" +
" left join video_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" where wpg.platform_id IS NOT NULL and wcg.parent_id = #{parentId} " +
" </script>")
Set<Group> queryShareChildrenGroup(@Param("parentId") Long parentId, @Param("platformId") Long platformId);
@Select(" <script>" +
" SELECT wcr.* " +
" from wvp_common_region wcr" +
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" from video_common_region wcr" +
" left join video_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" where wpr.platform_id IS NOT NULL and wcr.parent_device_id = #{parentId} " +
" </script>")
Set<Region> queryShareChildrenRegion(@Param("parentId") String parentId, @Param("platformId") Long platformId);
@Select(" <script>" +
" SELECT wcg.* " +
" from wvp_common_group wcg" +
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" from video_common_group wcg" +
" left join video_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
" where wpg.platform_id is not null and wcg.id in " +
"<foreach collection='groupSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
" </script>")
@@ -389,8 +389,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
@Select(" <script>" +
" SELECT wcr.* " +
" from wvp_common_region wcr" +
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" from video_common_region wcr" +
" left join video_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" where wpr.platform_id is not null and wcr.id in " +
"<foreach collection='regionSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
" </script>")
@@ -400,10 +400,10 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" SELECT " +
" pp.* " +
" FROM " +
" wvp_platform pp " +
" left join wvp_platform_channel pgc on " +
" video_platform pp " +
" left join video_platform_channel pgc on " +
" pp.id = pgc.platform_id " +
" left join wvp_device_channel dc on " +
" left join video_device_channel dc on " +
" dc.id = pgc.device_channel_id " +
" WHERE " +
" pgc.device_channel_id IN" +
@@ -415,27 +415,27 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" SELECT " +
" pp.* " +
" FROM " +
" wvp_platform pp " +
" left join wvp_platform_channel pgc on " +
" video_platform pp " +
" left join video_platform_channel pgc on " +
" pp.id = pgc.platform_id " +
" left join wvp_device_channel dc on " +
" left join video_device_channel dc on " +
" dc.id = pgc.device_channel_id " +
" WHERE " +
" pgc.device_channel_id = #{channelId}" +
"</script> ")
List<Platform> queryPlatFormListByChannelId(@Param("channelId") Long channelId);
@Update("UPDATE wvp_platform_channel SET deleted = 1 WHERE platform_id=#{platformId}")
@Update("UPDATE video_platform_channel SET deleted = 1 WHERE platform_id=#{platformId}")
void removeChannelsByPlatformId(@Param("platformId") Long platformId);
@Update("UPDATE wvp_platform_group SET deleted = 1 WHERE platform_id=#{platformId}")
@Update("UPDATE video_platform_group SET deleted = 1 WHERE platform_id=#{platformId}")
void removePlatformGroupsByPlatformId(@Param("platformId") Long platformId);
@Update("UPDATE wvp_platform_region SET deleted = 1 WHERE platform_id=#{platformId}")
@Update("UPDATE video_platform_region SET deleted = 1 WHERE platform_id=#{platformId}")
void removePlatformRegionByPlatformId(@Param("platformId") Long platformId);
@Update(value = {" <script>" +
" UPDATE wvp_platform_channel " +
" UPDATE video_platform_channel " +
" SET custom_device_id =#{customDeviceId}" +
" ,custom_name =#{customName}" +
" ,custom_manufacturer =#{customManufacturer}" +
@@ -516,8 +516,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
" 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" +
" from video_device_channel wdc" +
" left join video_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
" where wdc.channel_type = 0 and wpgc.platform_id = #{platformId} and wdc.id = #{gbId}" +
"</script>")
CommonGBChannel queryShareChannel(@Param("platformId") Long platformId, @Param("gbId") Long gbId);
@@ -525,8 +525,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
@Select(" <script>" +
" SELECT wcg.* " +
" from wvp_common_group wcg" +
" left join wvp_platform_group wpg on wpg.group_id = wcg.id " +
" from video_common_group wcg" +
" left join video_platform_group wpg on wpg.group_id = wcg.id " +
" where wpg.platform_id = #{platformId}" +
" order by wcg.id DESC" +
" </script>")
@@ -534,8 +534,8 @@ public interface PlatformChannelMapper extends BaseMapperX<PlatformChannel> {
@Select(" <script>" +
" SELECT wcr.* " +
" from wvp_common_region wcr" +
" left join wvp_platform_region wpr on wpr.region_id = wcr.id " +
" from video_common_region wcr" +
" left join video_platform_region wpr on wpr.region_id = wcr.id " +
" where wpr.platform_id = #{platformId}" +
" order by wcr.id DESC" +
" </script>")

View File

@@ -15,7 +15,7 @@ import java.util.List;
@Repository
public interface PlatformMapper extends BaseMapperX<Platform> {
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
@Insert("INSERT INTO video_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,server_id) " +
@@ -25,7 +25,7 @@ public interface PlatformMapper extends BaseMapperX<Platform> {
" #{civilCode}, #{manufacturer}, #{model}, #{address}, #{registerWay}, #{secrecy}, #{serverId})")
int add(Platform parentPlatform);
@Update("UPDATE wvp_platform " +
@Update("UPDATE video_platform " +
"SET update_time = #{updateTime}," +
" enable=#{enable}, " +
" name=#{name}," +
@@ -68,46 +68,46 @@ public interface PlatformMapper extends BaseMapperX<Platform> {
@Select(" <script>" +
" SELECT pp.*, " +
" ( (SELECT count(0) FROM wvp_platform_channel pc WHERE pc.platform_id = pp.id ) + " +
" (SELECT count(0) FROM wvp_platform_group pg WHERE pg.platform_id = pp.id ) * pp.catalog_with_group + " +
" (SELECT count(0) FROM wvp_platform_region pr WHERE pr.platform_id = pp.id ) * pp.catalog_with_region + " +
" ( (SELECT count(0) FROM video_platform_channel pc WHERE pc.platform_id = pp.id ) + " +
" (SELECT count(0) FROM video_platform_group pg WHERE pg.platform_id = pp.id ) * pp.catalog_with_group + " +
" (SELECT count(0) FROM video_platform_region pr WHERE pr.platform_id = pp.id ) * pp.catalog_with_region + " +
" pp.catalog_with_platform " +
" ) as channel_count" +
" FROM wvp_platform pp where 1=1 " +
" FROM video_platform pp where 1=1 " +
" <if test='query != null'> " +
" AND (pp.name LIKE concat('%',#{query},'%') escape '/' OR pp.server_gb_id LIKE concat('%',#{query},'%') escape '/' )</if> " +
" order by pp.id desc"+
" </script>")
IPage<Platform> queryList(IPage<Platform> page, @Param("query") String query);
@Select("SELECT * FROM wvp_platform WHERE server_id=#{serverId} and enable=#{enable} ")
@Select("SELECT * FROM video_platform WHERE server_id=#{serverId} and enable=#{enable} ")
List<Platform> queryEnableParentPlatformListByServerId(@Param("serverId") String serverId, @Param("enable") boolean enable);
@Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
@Select("SELECT * FROM video_platform WHERE enable=true and as_message_channel=true")
List<Platform> queryEnablePlatformListWithAsMessageChannel();
@Select("SELECT * FROM wvp_platform WHERE server_gb_id=#{platformGbId}")
@Select("SELECT * FROM video_platform WHERE server_gb_id=#{platformGbId}")
Platform getParentPlatByServerGBId(String platformGbId);
@Select("SELECT * FROM wvp_platform WHERE id=#{id}")
@Select("SELECT * FROM video_platform WHERE id=#{id}")
Platform query(Long id);
@Update("UPDATE wvp_platform SET status=#{online}, server_id = #{serverId} WHERE id=#{id}" )
@Update("UPDATE video_platform SET status=#{online}, server_id = #{serverId} WHERE id=#{id}" )
int updateStatus(@Param("id") Long id, @Param("online") boolean online, @Param("serverId") String serverId);
@Select("SELECT server_id FROM wvp_platform WHERE enable=true and server_id != #{serverId} group by server_id")
@Select("SELECT server_id FROM video_platform WHERE enable=true and server_id != #{serverId} group by server_id")
List<String> queryServerIdsWithEnableAndNotInServer(@Param("serverId") String serverId);
@Select("SELECT * FROM wvp_platform WHERE server_id = #{serverId}")
@Select("SELECT * FROM video_platform WHERE server_id = #{serverId}")
List<Platform> queryByServerId(@Param("serverId") String serverId);
@Select("SELECT * FROM wvp_platform ")
@Select("SELECT * FROM video_platform ")
List<Platform> queryAll();
@Select("SELECT * FROM wvp_platform WHERE enable=true and server_id = #{serverId}")
@Select("SELECT * FROM video_platform WHERE enable=true and server_id = #{serverId}")
List<Platform> queryServerIdsWithEnableAndServer(@Param("serverId") String serverId);
@Update("UPDATE wvp_platform SET status=false where server_id = #{serverId}" )
@Update("UPDATE video_platform SET status=false where server_id = #{serverId}" )
void offlineAll(@Param("serverId") String serverId);
}

View File

@@ -14,7 +14,7 @@ import java.util.Set;
@Mapper
public interface RegionMapper extends BaseMapperX<Region> {
@Insert("INSERT INTO wvp_common_region (device_id, name, parent_id, parent_device_id, create_time, update_time) " +
@Insert("INSERT INTO video_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);
@@ -23,33 +23,33 @@ public interface RegionMapper extends BaseMapperX<Region> {
return deleteById(id);
}
@Update(" UPDATE wvp_common_region " +
@Update(" UPDATE video_common_region " +
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, parent_device_id=#{parentDeviceId}" +
" WHERE id = #{id}")
int update(Region region);
@Select(value = {" <script>" +
"SELECT * from wvp_common_region WHERE 1=1 " +
"SELECT * from video_common_region WHERE 1=1 " +
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') escape '/' OR name LIKE concat('%',#{query},'%') escape '/')</if> " +
" <if test='parentId != null'> AND parent_device_id = #{parentId}</if> " +
"ORDER BY id " +
" </script>"})
IPage<Region> query(IPage<Region> page, @Param("query") String query, @Param("parentId") String parentId);
@Select("SELECT * from wvp_common_region WHERE parent_id = #{parentId} ORDER BY id ")
@Select("SELECT * from video_common_region WHERE parent_id = #{parentId} ORDER BY id ")
List<Region> getChildren(@Param("parentId") Long parentId);
@Select("SELECT * from wvp_common_region WHERE id = #{id} ")
@Select("SELECT * from video_common_region WHERE id = #{id} ")
Region queryOne(@Param("id") Long id);
@Select(" select dc.civil_code as civil_code " +
" from wvp_device_channel dc " +
" from video_device_channel dc " +
" where dc.civil_code not in " +
" (select device_id from wvp_common_region)")
" (select device_id from video_common_region)")
List<String> getUninitializedCivilCode();
@Select(" <script>" +
" SELECT device_id from wvp_common_region " +
" SELECT device_id from video_common_region " +
" where device_id in " +
" <foreach collection='codes' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>")
@@ -57,7 +57,7 @@ public interface RegionMapper extends BaseMapperX<Region> {
@Insert(" <script>" +
" INSERT INTO wvp_common_region (" +
" INSERT INTO video_common_region (" +
" device_id," +
" name, " +
" parent_device_id," +
@@ -79,7 +79,7 @@ public interface RegionMapper extends BaseMapperX<Region> {
" 0 as type," +
" 'ON' as status," +
" false as is_leaf" +
" from wvp_common_region " +
" from video_common_region " +
" where " +
" <if test='parentId != null'> parent_id = #{parentId} </if> " +
" <if test='parentId == null'> parent_id is null </if> " +
@@ -93,7 +93,7 @@ public interface RegionMapper extends BaseMapperX<Region> {
}
@Select(" <script>" +
" SELECT * from wvp_common_region " +
" SELECT * from video_common_region " +
" where device_id in " +
" <foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
" </script>")
@@ -103,39 +103,39 @@ public interface RegionMapper extends BaseMapperX<Region> {
" SELECT " +
" wcr.device_id as gb_device_id," +
" wcr.name as gb_name" +
" from wvp_common_region wcr" +
" left join wvp_platform_region wpr on wcr.id = wpr.region_id" +
" from video_common_region wcr" +
" left join video_platform_region wpr on wcr.id = wpr.region_id" +
" where wpr.platform_id = #{platformId} " +
" </script>")
List<CommonGBChannel> queryByPlatform(@Param("platformId") Long platformId);
@Update(value = " <script>" +
" update wvp_common_region w1 " +
" inner join (select * from wvp_common_region ) w2 on w1.parent_device_id = w2.device_id " +
" update video_common_region w1 " +
" inner join (select * from video_common_region ) w2 on w1.parent_device_id = w2.device_id " +
" set w1.parent_id = w2.id" +
" where w1.id in " +
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "mysql")
@Update(value = " <script>" +
" update wvp_common_region w1 " +
" inner join (select * from wvp_common_region ) w2 on w1.parent_device_id = w2.device_id " +
" update video_common_region w1 " +
" inner join (select * from video_common_region ) w2 on w1.parent_device_id = w2.device_id " +
" set w1.parent_id = w2.id" +
" where w1.id in " +
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "h2")
@Update( value = " <script>" +
" update wvp_common_region w1\n" +
" update video_common_region w1\n" +
" set parent_id = w2.id\n" +
" from wvp_common_region w2\n" +
" from video_common_region w2\n" +
" where w1.parent_device_id = w2.device_id\n" +
" and w1.id in " +
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>", databaseId = "kingbase")
@Update( value = " <script>" +
" update wvp_common_region w1\n" +
" update video_common_region w1\n" +
" set parent_id = w2.id\n" +
" from wvp_common_region w2\n" +
" from video_common_region w2\n" +
" where w1.parent_device_id = w2.device_id\n" +
" and w1.id in " +
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
@@ -143,19 +143,19 @@ public interface RegionMapper extends BaseMapperX<Region> {
void updateParentId(List<Region> regionListForAdd);
@Update(" <script>" +
" update wvp_common_region" +
" update video_common_region" +
" set parent_device_id = #{parentDeviceId}" +
" where parent_id = #{parentId} " +
" </script>")
void updateChild(@Param("parentId") Long parentId, @Param("parentDeviceId") String parentDeviceId);
@Select("SELECT * from wvp_common_region WHERE device_id = #{deviceId} ")
@Select("SELECT * from video_common_region WHERE device_id = #{deviceId} ")
Region queryByDeviceId(@Param("deviceId") String deviceId);
@Select(" <script>" +
" SELECT " +
" * " +
" from wvp_common_region " +
" from video_common_region " +
" where id in " +
" <foreach collection='regionSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
" </script>")
@@ -164,7 +164,7 @@ public interface RegionMapper extends BaseMapperX<Region> {
@Select(" <script>" +
" SELECT " +
" * " +
" from wvp_common_region " +
" from video_common_region " +
" where device_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbCivilCode}</foreach>" +
" order by id " +
@@ -173,8 +173,8 @@ public interface RegionMapper extends BaseMapperX<Region> {
@Select(" <script>" +
" SELECT * " +
" from wvp_common_region wcr" +
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" from video_common_region wcr" +
" left join video_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" where wpr.platform_id is null and wcr.device_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbCivilCode}</foreach>" +
" </script>")
@@ -182,8 +182,8 @@ public interface RegionMapper extends BaseMapperX<Region> {
@Select(" <script>" +
" SELECT * " +
" from wvp_common_region wcr" +
" left join wvp_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" from video_common_region wcr" +
" left join video_platform_region wpr on wpr.region_id = wcr.id and wpr.platform_id = #{platformId}" +
" where wpr.platform_id IS NULL and wcr.id in " +
" <foreach collection='allRegion' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>")
@@ -192,7 +192,7 @@ public interface RegionMapper extends BaseMapperX<Region> {
@Select(" <script>" +
" SELECT device_id " +
" from wvp_common_region" +
" from video_common_region" +
" where device_id in " +
" <foreach collection='civilCodePoList' item='item' open='(' separator=',' close=')' > #{item.code}</foreach>" +
" </script>")

View File

@@ -56,7 +56,7 @@ public class ChannelProvider {
" 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"
" from video_device_channel\n"
;
public final static String BASE_SQL_TABLE_NAME = "select\n" +
@@ -102,7 +102,7 @@ public class ChannelProvider {
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel wdc\n"
" from video_device_channel wdc\n"
;
private final static String BASE_SQL_FOR_PLATFORM =
@@ -147,8 +147,8 @@ public class ChannelProvider {
" 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"
" from video_device_channel wdc" +
" left join video_platform_channel wpgc on wdc.id = wpgc.device_channel_id"
;
private final static String BASE_SQL_FOR_CAMERA_DEVICE =
@@ -198,10 +198,10 @@ public class ChannelProvider {
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel wdc\n" +
" left join wvp_device wd on wdc.data_type = 1 AND wd.id = wdc.data_device_id" +
" left join wvp_common_group wcg on wcg.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
" left join wvp_common_group wcg2 on wcg2.device_id = wcg.business_group"
" from video_device_channel wdc\n" +
" left join video_device wd on wdc.data_type = 1 AND wd.id = wdc.data_device_id" +
" left join video_common_group wcg on wcg.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
" left join video_common_group wcg2 on wcg2.device_id = wcg.business_group"
;
public String queryByDeviceId(Map<String, Object> params ){
@@ -500,7 +500,7 @@ public class ChannelProvider {
public String queryListByCivilCodeForUnusual(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_TABLE_NAME);
sqlBuild.append(" left join (select wcr.device_id from wvp_common_region wcr) temp on temp.device_id = coalesce(wdc.gb_civil_code, wdc.civil_code)" +
sqlBuild.append(" left join (select wcr.device_id from video_common_region wcr) temp on temp.device_id = coalesce(wdc.gb_civil_code, wdc.civil_code)" +
" where coalesce(wdc.gb_civil_code, wdc.civil_code) is not null and temp.device_id is null ");
sqlBuild.append(" AND wdc.channel_type = 0 ");
if (params.get("query") != null) {
@@ -523,7 +523,7 @@ public class ChannelProvider {
public String queryListByParentForUnusual(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_TABLE_NAME);
sqlBuild.append(" left join (select wcg.device_id from wvp_common_group wcg) temp on temp.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
sqlBuild.append(" left join (select wcg.device_id from video_common_group wcg) temp on temp.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
" where coalesce(wdc.gb_parent_id, wdc.parent_id) is not null and temp.device_id is null ");
sqlBuild.append(" AND wdc.channel_type = 0 ");
if (params.get("query") != null) {
@@ -578,8 +578,8 @@ public class ChannelProvider {
public String queryAllForUnusualCivilCode(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append("select wdc.id from wvp_device_channel wdc ");
sqlBuild.append(" left join (select wcr.device_id from wvp_common_region wcr) temp on temp.device_id = coalesce(wdc.gb_civil_code, wdc.civil_code)" +
sqlBuild.append("select wdc.id from video_device_channel wdc ");
sqlBuild.append(" left join (select wcr.device_id from video_common_region wcr) temp on temp.device_id = coalesce(wdc.gb_civil_code, wdc.civil_code)" +
" where coalesce(wdc.gb_civil_code, wdc.civil_code) is not null and temp.device_id is null ");
sqlBuild.append(" AND wdc.channel_type = 0 ");
return sqlBuild.toString();
@@ -587,8 +587,8 @@ public class ChannelProvider {
public String queryAllForUnusualParent(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append("select wdc.id from wvp_device_channel wdc ");
sqlBuild.append(" left join (select wcg.device_id from wvp_common_group wcg) temp on temp.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
sqlBuild.append("select wdc.id from video_device_channel wdc ");
sqlBuild.append(" left join (select wcg.device_id from video_common_group wcg) temp on temp.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
" where coalesce(wdc.gb_parent_id, wdc.parent_id) is not null and temp.device_id is null ");
sqlBuild.append(" AND wdc.channel_type = 0 ");
return sqlBuild.toString();

View File

@@ -57,8 +57,8 @@ public class DeviceChannelProvider {
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
" from " +
" wvp_device_channel dc " +
" left join wvp_device d on d.id = dc.data_device_id "
" video_device_channel dc " +
" left join video_device d on d.id = dc.data_device_id "
;
}
public String queryChannels(Map<String, Object> params ){

View File

@@ -12,7 +12,7 @@ import org.springframework.util.ObjectUtils;
@Schema(description = "流媒体服务信息")
@Data
@TableName("wvp_media_server")
@TableName("video_media_server")
@EqualsAndHashCode(callSuper = true)
public class MediaServer extends BaseDO {

View File

@@ -3,7 +3,7 @@ package com.viewsh.module.video.service.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import com.viewsh.module.video.media.event.media.MediaRecordMp4Event;
import com.viewsh.module.video.media.event.media.MediaRecordProcessEvent;
import com.viewsh.module.video.utils.MediaServerUtils;
@@ -16,9 +16,9 @@ import java.util.Map;
* 云端录像数据
*/
@Data
@TableName("wvp_cloud_record")
@TableName("video_cloud_record")
@EqualsAndHashCode(callSuper = true)
public class CloudRecordItem extends TenantBaseDO {
public class CloudRecordItem extends ProjectBaseDO {
/**
* 主键
*/

View File

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -12,10 +12,10 @@ import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@TableName("wvp_record_plan")
@TableName("video_record_plan")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "录制计划")
public class RecordPlan extends TenantBaseDO {
public class RecordPlan extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "计划数据库ID")

View File

@@ -3,16 +3,16 @@ package com.viewsh.module.video.service.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.viewsh.framework.tenant.core.db.TenantBaseDO;
import com.viewsh.framework.tenant.core.db.ProjectBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName("wvp_record_plan_item")
@TableName("video_record_plan_item")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "录制计划项")
public class RecordPlanItem extends TenantBaseDO {
public class RecordPlanItem extends ProjectBaseDO {
@TableId(type = IdType.AUTO)
@Schema(description = "计划项数据库ID")

View File

@@ -14,7 +14,7 @@ import java.util.List;
public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Insert(" <script>" +
"INSERT INTO wvp_cloud_record (" +
"INSERT INTO video_cloud_record (" +
" app," +
" stream," +
"<if test=\"callId != null\"> call_id,</if>" +
@@ -45,7 +45,7 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Select(" <script>" +
"select * " +
" from wvp_cloud_record " +
" from video_cloud_record " +
" where 1 = 1" +
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') escape '/' OR stream LIKE concat('%',#{query},'%') escape '/' )</if> " +
" <if test= 'app != null '> and app=#{app}</if>" +
@@ -69,7 +69,7 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Select(" <script>" +
"select * " +
" from wvp_cloud_record " +
" from video_cloud_record " +
" where 1 = 1" +
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') escape '/' OR stream LIKE concat('%',#{query},'%') escape '/' )</if> " +
" <if test= 'app != null '> and app=#{app}</if>" +
@@ -94,7 +94,7 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Select(" <script>" +
"select file_path" +
" from wvp_cloud_record " +
" from video_cloud_record " +
" where 0 = 0" +
" <if test= 'app != null '> and app=#{app}</if>" +
" <if test= 'stream != null '> and stream=#{stream}</if>" +
@@ -110,13 +110,13 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Param("callId")String callId, List<MediaServer> mediaServerItemList);
@Update(" <script>" +
"update wvp_cloud_record set collect = #{collect} where file_path in " +
"update video_cloud_record set collect = #{collect} where file_path in " +
" <foreach collection='cloudRecordItemList' item='item' open='(' separator=',' close=')' > #{item.filePath}</foreach>" +
" </script>")
int updateCollectList(@Param("collect") boolean collect, List<CloudRecordItem> cloudRecordItemList);
@Update(" <script>" +
"UPDATE wvp_cloud_record SET deleted = 1 WHERE media_server_id=#{mediaServerId} and file_path in " +
"UPDATE video_cloud_record SET deleted = 1 WHERE media_server_id=#{mediaServerId} and file_path in " +
" <foreach collection='filePathList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>")
void deleteByFileList(@Param("filePathList") List<String> filePathList, @Param("mediaServerId") String mediaServerId);
@@ -124,13 +124,13 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
" from video_cloud_record " +
" where collect = false and end_time &lt;= #{endTimeStamp} and media_server_id = #{mediaServerId} " +
" </script>")
List<CloudRecordItem> queryRecordListForDelete(@Param("endTimeStamp")Long endTimeStamp, String mediaServerId);
@Update(" <script>" +
"update wvp_cloud_record set collect = #{collect} where id = #{recordId} " +
"update video_cloud_record set collect = #{collect} where id = #{recordId} " +
" </script>")
int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Long recordId);
@@ -142,33 +142,33 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
" from video_cloud_record " +
"where call_id = #{callId}" +
" </script>")
List<CloudRecordItem> getListByCallId(@Param("callId") String callId);
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
" from video_cloud_record " +
"where id = #{id}" +
" </script>")
CloudRecordItem queryOne(@Param("id") Long id);
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
" from video_cloud_record " +
" where app=#{app} and stream=#{stream} and file_name = #{fileName} " +
" </script>")
CloudRecordItem getListByFileName(@Param("app") String app, @Param("stream") String stream, @Param("fileName") String fileName);
@Update(" <script>" +
"update wvp_cloud_record set time_len = #{time}, end_time = #{endTime} where id = #{id} " +
"update video_cloud_record set time_len = #{time}, end_time = #{endTime} where id = #{id} " +
" </script>")
void updateTimeLen(@Param("id") Long id, @Param("time") Long time, @Param("endTime") long endTime);
@Select(" <script>" +
"select media_server_id " +
" from wvp_cloud_record " +
" from video_cloud_record " +
" where 0 = 0" +
" <if test= 'app != null '> and app=#{app}</if>" +
" <if test= 'stream != null '> and stream=#{stream}</if>" +
@@ -183,14 +183,14 @@ public interface CloudRecordServiceMapper extends BaseMapperX<CloudRecordItem> {
@Select(" <script>" +
"select * " +
" from wvp_cloud_record where id in " +
" from video_cloud_record where id in " +
" <foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>")
List<CloudRecordItem> queryRecordByIds(Collection<Long> ids);
@Select(" <script>" +
"select * " +
" from wvp_cloud_record where 0=0 " +
" from video_cloud_record where 0=0 " +
" <if test= 'app != null '> and app=#{app}</if>" +
" <if test= 'stream != null '> and stream=#{stream}</if>" +
" <if test= 'callId != null '> and call_id=#{callId}</if>" +

View File

@@ -14,7 +14,7 @@ import java.util.List;
@Repository
public interface MediaServerMapper extends BaseMapperX<MediaServer> {
@Insert("INSERT INTO wvp_media_server (" +
@Insert("INSERT INTO video_media_server (" +
"id,"+
"ip,"+
"hook_ip,"+
@@ -86,7 +86,7 @@ public interface MediaServerMapper extends BaseMapperX<MediaServer> {
int add(MediaServer mediaServerItem);
@Update(value = {" <script>" +
"UPDATE wvp_media_server " +
"UPDATE video_media_server " +
"SET update_time=#{updateTime}, transcode_suffix=#{transcodeSuffix} " +
", 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}" +
@@ -102,7 +102,7 @@ public interface MediaServerMapper extends BaseMapperX<MediaServer> {
int update(MediaServer mediaServerItem);
@Update(value = {" <script>" +
"UPDATE wvp_media_server " +
"UPDATE video_media_server " +
"SET update_time=#{updateTime}" +
"<if test=\"id != null\">, id=#{id}</if>" +
"<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
@@ -136,16 +136,16 @@ public interface MediaServerMapper extends BaseMapperX<MediaServer> {
" </script>"})
int updateByHostAndPort(MediaServer mediaServerItem);
@Select("SELECT * FROM wvp_media_server WHERE id=#{id}")
@Select("SELECT * FROM video_media_server WHERE id=#{id}")
MediaServer queryOne(@Param("id") String id);
@Select("SELECT * FROM wvp_media_server WHERE id=#{id} and server_id = #{serverId}")
@Select("SELECT * FROM video_media_server WHERE id=#{id} and server_id = #{serverId}")
MediaServer queryOneWithServerId(@Param("id") String id, @Param("serverId") String serverId);
@Select("SELECT * FROM wvp_media_server where server_id = #{serverId}")
@Select("SELECT * FROM video_media_server where server_id = #{serverId}")
List<MediaServer> queryAll(@Param("serverId") String serverId);
@Select("SELECT * FROM wvp_media_server where default_server=false AND server_id = #{serverId}")
@Select("SELECT * FROM video_media_server where default_server=false AND server_id = #{serverId}")
List<MediaServer> queryAllWithOutDefault(@Param("serverId") String serverId);
default void delOne(String id, String serverId) {
@@ -154,13 +154,13 @@ public interface MediaServerMapper extends BaseMapperX<MediaServer> {
.eq(MediaServer::getServerId, serverId));
}
@Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port} and server_id = #{serverId}")
@Select("SELECT * FROM video_media_server WHERE ip=#{host} and http_port=#{port} and server_id = #{serverId}")
MediaServer queryOneByHostAndPort(@Param("host") String host, @Param("port") int port, @Param("serverId") String serverId);
@Select("SELECT * FROM wvp_media_server WHERE default_server=true and server_id = #{serverId}")
@Select("SELECT * FROM video_media_server WHERE default_server=true and server_id = #{serverId}")
MediaServer queryDefault(@Param("serverId") String serverId);
@Select("SELECT * FROM wvp_media_server WHERE record_assist_port > 0 and server_id = #{serverId}")
@Select("SELECT * FROM video_media_server WHERE record_assist_port > 0 and server_id = #{serverId}")
List<MediaServer> queryAllWithAssistPort(@Param("serverId") String serverId);
default void deleteDefault(String serverId) {

View File

@@ -12,7 +12,7 @@ import java.util.List;
public interface RecordPlanMapper extends BaseMapperX<RecordPlan> {
@Insert(" <script>" +
"INSERT INTO wvp_record_plan (" +
"INSERT INTO video_record_plan (" +
" name," +
" snap) " +
"VALUES (" +
@@ -23,7 +23,7 @@ public interface RecordPlanMapper extends BaseMapperX<RecordPlan> {
void add(RecordPlan plan);
@Insert(" <script>" +
"INSERT INTO wvp_record_plan_item (" +
"INSERT INTO video_record_plan_item (" +
"start," +
"stop, " +
"week_day," +
@@ -35,31 +35,31 @@ public interface RecordPlanMapper extends BaseMapperX<RecordPlan> {
" </script>")
void batchAddItem(@Param("planId") Long planId, List<RecordPlanItem> planItemList);
@Select("select * from wvp_record_plan where id = #{planId}")
@Select("select * from video_record_plan where id = #{planId}")
RecordPlan get(@Param("planId") Long planId);
@Select(" <script>" +
" SELECT wrp.*, (select count(1) from wvp_device_channel where record_plan_id = wrp.id) AS channelCount\n" +
" FROM wvp_record_plan wrp where 1=1" +
" SELECT wrp.*, (select count(1) from video_device_channel where record_plan_id = wrp.id) AS channelCount\n" +
" FROM video_record_plan wrp where 1=1" +
" <if test='query != null'> AND (name LIKE concat('%',#{query},'%') escape '/' )</if> " +
" </script>")
IPage<RecordPlan> query(IPage<RecordPlan> page, @Param("query") String query);
@Update("UPDATE wvp_record_plan SET name=#{name}, snap=#{snap} WHERE id=#{id}")
@Update("UPDATE video_record_plan SET name=#{name}, snap=#{snap} WHERE id=#{id}")
void update(RecordPlan plan);
default void delete(Long planId) {
deleteById(planId);
}
@Select("select * from wvp_record_plan_item where plan_id = #{planId}")
@Select("select * from video_record_plan_item where plan_id = #{planId}")
List<RecordPlanItem> getItemList(@Param("planId") Long planId);
@Update("UPDATE wvp_record_plan_item SET deleted = 1 WHERE plan_id = #{planId}")
@Update("UPDATE video_record_plan_item SET deleted = 1 WHERE plan_id = #{planId}")
void cleanItems(@Param("planId") Long planId);
@Select(" <script>" +
" select wdc.id from wvp_device_channel wdc left join wvp_record_plan_item wrpi on wrpi.plan_id = wdc.record_plan_id " +
" select wdc.id from video_device_channel wdc left join video_record_plan_item wrpi on wrpi.plan_id = wdc.record_plan_id " +
" where wrpi.week_day = #{week} and wrpi.start &lt;= #{index} and stop &gt;= #{index} group by wdc.id" +
" </script>")
List<Long> queryRecordIng(@Param("week") int week, @Param("index") int index);

View File

@@ -14,7 +14,7 @@ import org.springframework.util.ObjectUtils;
* @author lin
*/
@Data
@TableName("wvp_stream_proxy")
@TableName("video_stream_proxy")
@Schema(description = "拉流代理的信息")
@EqualsAndHashCode(callSuper = true)
public class StreamProxy extends CommonGBChannel {

View File

@@ -14,7 +14,7 @@ import java.util.List;
@Repository
public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
@Insert("INSERT INTO wvp_stream_proxy (type, app, stream,relates_media_server_id, src_url, " +
@Insert("INSERT INTO video_stream_proxy (type, app, stream,relates_media_server_id, src_url, " +
"timeout, ffmpeg_cmd_key, rtsp_type, enable_audio, enable_mp4, enable, pulling, " +
"enable_disable_none_reader, server_id, camera_code, camera_name, area_id, edge_device_id) VALUES" +
"(#{type}, #{app}, #{stream}, #{relatesMediaServerId}, #{srcUrl}, " +
@@ -23,7 +23,7 @@ public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int add(StreamProxy streamProxyDto);
@Update("UPDATE wvp_stream_proxy " +
@Update("UPDATE video_stream_proxy " +
"SET type=#{type}, " +
"app=#{app}," +
"stream=#{stream}," +
@@ -59,10 +59,10 @@ public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
List<StreamProxy> selectForPushingInMediaServer(@Param("mediaServerId") String mediaServerId, @Param("enable") boolean enable);
@Select("select count(1) from wvp_stream_proxy")
@Select("select count(1) from video_stream_proxy")
int getAllCount();
@Select("select count(1) from wvp_stream_proxy where pulling = true")
@Select("select count(1) from video_stream_proxy where pulling = true")
int getOnline();
default int delete(Long id) {
@@ -75,12 +75,12 @@ public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
deleteBatch(StreamProxy::getId, ids);
}
@Update("UPDATE wvp_stream_proxy " +
@Update("UPDATE video_stream_proxy " +
"SET pulling=true " +
"WHERE id=#{id}")
int online(@Param("id") Long id);
@Update("UPDATE wvp_stream_proxy " +
@Update("UPDATE video_stream_proxy " +
"SET pulling=false " +
"WHERE id=#{id}")
int offline(@Param("id") Long id);
@@ -88,13 +88,13 @@ public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
@SelectProvider(type = StreamProxyProvider.class, method = "select")
StreamProxy select(@Param("id") Long id);
@Update("UPDATE wvp_stream_proxy " +
@Update("UPDATE video_stream_proxy " +
" SET pulling=false, media_server_id = null," +
" stream_key = null " +
" WHERE id=#{id}")
void removeStream(@Param("id") Long id);
@Update("UPDATE wvp_stream_proxy " +
@Update("UPDATE video_stream_proxy " +
" SET pulling=#{pulling}, media_server_id = #{mediaServerId}, " +
" stream_key = #{streamKey} " +
" WHERE id=#{id}")
@@ -105,36 +105,36 @@ public interface StreamProxyMapper extends BaseMapperX<StreamProxy> {
* @param cameraCode 摄像头全局唯一编码
* @return StreamProxy 对象,不存在返回 null
*/
@Select("SELECT * FROM wvp_stream_proxy WHERE camera_code = #{cameraCode}")
@Select("SELECT * FROM video_stream_proxy WHERE camera_code = #{cameraCode}")
StreamProxy selectByCameraCode(@Param("cameraCode") String cameraCode);
/**
* 查询 camera_code 为 NULL 或空的记录(需要回填)
*/
@Select("SELECT * FROM wvp_stream_proxy WHERE camera_code IS NULL OR camera_code = ''")
@Select("SELECT * FROM video_stream_proxy WHERE camera_code IS NULL OR camera_code = ''")
List<StreamProxy> selectWithNullCameraCode();
/**
* 更新指定记录的 camera_code
*/
@Update("UPDATE wvp_stream_proxy SET camera_code = #{cameraCode} WHERE id = #{id}")
@Update("UPDATE video_stream_proxy SET camera_code = #{cameraCode} WHERE id = #{id}")
int updateCameraCode(@Param("id") Long id, @Param("cameraCode") String cameraCode);
/**
* 查询指定前缀的最大 camera_code用于生成新编码的序号
*/
@Select("SELECT MAX(camera_code) FROM wvp_stream_proxy WHERE camera_code LIKE CONCAT(#{prefix}, '%')")
@Select("SELECT MAX(camera_code) FROM video_stream_proxy WHERE camera_code LIKE CONCAT(#{prefix}, '%')")
String selectMaxCameraCodeByPrefix(@Param("prefix") String prefix);
/**
* 查询所有摄像头简要信息(用于前端下拉选择)
*/
@Select("SELECT camera_code, camera_name FROM wvp_stream_proxy WHERE enable = 1 ORDER BY camera_name")
@Select("SELECT camera_code, camera_name FROM video_stream_proxy WHERE enable = 1 ORDER BY camera_name")
List<StreamProxy> selectAllCameraOptions();
/**
* 根据 camera_code 查询关联的边缘设备 ID
*/
@Select("SELECT edge_device_id FROM wvp_stream_proxy WHERE camera_code = #{cameraCode}")
@Select("SELECT edge_device_id FROM video_stream_proxy WHERE camera_code = #{cameraCode}")
String selectEdgeDeviceIdByCameraCode(@Param("cameraCode") String cameraCode);
}

View File

@@ -13,8 +13,8 @@ public class StreamProxyProvider {
" st.id as data_device_id, " +
" wdc.*, " +
" wdc.id as gb_id" +
" FROM wvp_stream_proxy st " +
" LEFT join wvp_device_channel wdc " +
" FROM video_stream_proxy st " +
" LEFT join video_device_channel wdc " +
" on wdc.data_type = 3 and st.id = wdc.data_device_id ";
}

View File

@@ -16,7 +16,7 @@ import org.springframework.util.ObjectUtils;
@Data
@TableName("wvp_stream_push")
@TableName("video_stream_push")
@Schema(description = "推流信息")
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor

View File

@@ -19,14 +19,14 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
Integer dataType = ChannelDataType.GB28181;
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, pushing, start_offline_push) VALUES" +
@Insert("INSERT INTO video_stream_push (app, stream, media_server_id, server_id, push_time, pushing, start_offline_push) VALUES" +
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime}, #{pushing}, #{startOfflinePush})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int add(StreamPush streamPushItem);
@Update(value = {" <script>" +
"UPDATE wvp_stream_push " +
"UPDATE video_stream_push " +
"SET update_time=NOW()" +
"<if test=\"app != null\">, app=#{app}</if>" +
"<if test=\"stream != null\">, stream=#{stream}</if>" +
@@ -50,8 +50,8 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
" wdc.*, " +
" wdc.id as gb_id" +
" from " +
" wvp_stream_push st " +
" LEFT join wvp_device_channel wdc " +
" video_stream_push st " +
" LEFT join video_device_channel wdc " +
" on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" WHERE " +
" 1=1 " +
@@ -71,8 +71,8 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
" wdc.*, " +
" wdc.id as gb_id" +
" from " +
" wvp_stream_push st " +
" LEFT join wvp_device_channel wdc " +
" video_stream_push st " +
" LEFT join video_device_channel wdc " +
" on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" WHERE " +
" 1=1 " +
@@ -85,11 +85,11 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
" </script>"})
List<StreamPush> selectAllList(@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}")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM video_stream_push st LEFT join video_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.app=#{app} AND st.stream=#{stream}")
StreamPush selectByAppAndStream(@Param("app") String app, @Param("stream") String stream);
@Insert("<script>" +
"Insert INTO wvp_stream_push ( " +
"Insert INTO video_stream_push ( " +
" app, stream, media_server_id, server_id, push_time, pushing, start_offline_push) " +
" VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
" ( #{item.app}, #{item.stream}, #{item.mediaServerId},#{item.serverId} ,#{item.pushTime}, #{item.pushing}, #{item.startOfflinePush} )" +
@@ -98,19 +98,19 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int addAll(List<StreamPush> streamPushItems);
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId}")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM video_stream_push st LEFT join video_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId}")
List<StreamPush> selectAllByMediaServerId(String mediaServerId);
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId} and wdc.gb_device_id is null")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM video_stream_push st LEFT join video_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId} and wdc.gb_device_id is null")
List<StreamPush> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
@Update("UPDATE wvp_stream_push " +
@Update("UPDATE video_stream_push " +
"SET pushing=#{pushing}, server_id=#{serverId}, media_server_id=#{mediaServerId} " +
"WHERE id=#{id}")
int updatePushStatus(StreamPush streamPush);
@Select("<script> "+
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM video_stream_push st LEFT join video_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
"where (st.app, st.stream) in (" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " +
@@ -119,36 +119,36 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
List<StreamPush> getListInList(List<StreamPushItemFromRedis> offlineStreams);
@Select("SELECT CONCAT(app,stream) from wvp_stream_push")
@Select("SELECT CONCAT(app,stream) from video_stream_push")
List<String> getAllAppAndStream();
@Select("select count(1) from wvp_stream_push ")
@Select("select count(1) from video_stream_push ")
int getAllCount();
@Select(value = {" <script>" +
" select count(1) from wvp_stream_push where pushing = true" +
" select count(1) from video_stream_push where pushing = true" +
" </script>"})
int getAllPushing(Boolean usePushingAsStatus);
@MapKey("uniqueKey")
@Select("SELECT CONCAT(wsp.app, wsp.stream) as unique_key, wsp.*, wdc.* , " +
" 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")
" from video_stream_push wsp " +
" LEFT join video_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
Map<String, StreamPush> getAllAppAndStreamMap();
@MapKey("gbDeviceId")
@Select("SELECT wdc.gb_device_id, wsp.id as data_device_id, wsp.*, wsp.* , wdc.id as gb_id " +
" from wvp_stream_push wsp " +
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
" from video_stream_push wsp " +
" LEFT join video_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
Map<String, StreamPush> getAllGBId();
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.id=#{id}")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM video_stream_push st LEFT join video_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.id=#{id}")
StreamPush queryOne(@Param("id") Long id);
@Select("<script> "+
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM video_stream_push st LEFT join video_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" where st.id in (" +
" <foreach collection='ids' item='item' separator=','>" +
" #{item} " +
@@ -166,7 +166,7 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
@Update({"<script>" +
"<foreach collection='streamPushItemForUpdate' item='item' separator=';'>" +
" UPDATE" +
" wvp_stream_push" +
" video_stream_push" +
" SET update_time=NOW()" +
", app=#{item.app}" +
", stream=#{item.stream}" +
@@ -180,13 +180,13 @@ public interface StreamPushMapper extends BaseMapperX<StreamPush> {
"</script>"})
int batchUpdate(List<StreamPush> streamPushItemForUpdate);
@Update(" UPDATE wvp_stream_push SET deleted = 1" +
@Update(" UPDATE video_stream_push SET deleted = 1" +
" WHERE server_id = #{serverId}" +
" AND NOT EXISTS (" +
" SELECT 1 " +
" FROM wvp_device_channel wdc " +
" FROM video_device_channel wdc " +
" WHERE wdc.data_type = 2 " +
" AND wvp_stream_push.id = wdc.data_device_id" +
" AND video_stream_push.id = wdc.data_device_id" +
" )")
void deleteWithoutGBId(@Param("serverId") String serverId);
}

View File

@@ -118,8 +118,12 @@ viewsh:
version: ${viewsh.info.version}
tenant: # 多租户相关配置项
enable: true
ignore-tables:
- wvp_media_server
ignore-tables: # 不进行租户过滤的表(全局共享表)
- video_media_server
ignore-project-tables: # 不进行项目隔离的表(租户级字典表 + 全局共享表)
- video_media_server
- video_ai_algorithm
- video_ai_algo_template
--- #################### WVP GB28181 相关配置 ####################