feat(aiot): 告警详情和列表显示摄像头名称
- AiAlert添加cameraName字段 - Mapper查询时LEFT JOIN wvp_stream_proxy表获取gb_name - 通过camera_code关联查询 - 优先显示cameraName,降级显示cameraId Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,9 @@ public class AiAlert {
|
|||||||
@Schema(description = "摄像头ID")
|
@Schema(description = "摄像头ID")
|
||||||
private String cameraId;
|
private String cameraId;
|
||||||
|
|
||||||
|
@Schema(description = "摄像头名称(关联查询)")
|
||||||
|
private String cameraName;
|
||||||
|
|
||||||
@Schema(description = "ROI区域ID")
|
@Schema(description = "ROI区域ID")
|
||||||
private String roiId;
|
private String roiId;
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,20 @@ public interface AiAlertMapper {
|
|||||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||||
int add(AiAlert alert);
|
int add(AiAlert alert);
|
||||||
|
|
||||||
@Select("SELECT a.*, r.name AS roi_name FROM wvp_ai_alert a " +
|
@Select("SELECT a.*, r.name AS roi_name, sp.gb_name AS camera_name FROM wvp_ai_alert a " +
|
||||||
"LEFT JOIN wvp_ai_roi r ON a.roi_id = r.roi_id " +
|
"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 " +
|
||||||
"WHERE a.alert_id=#{alertId}")
|
"WHERE a.alert_id=#{alertId}")
|
||||||
@Results({
|
@Results({
|
||||||
@Result(property = "roiName", column = "roi_name")
|
@Result(property = "roiName", column = "roi_name"),
|
||||||
|
@Result(property = "cameraName", column = "camera_name")
|
||||||
})
|
})
|
||||||
AiAlert queryByAlertId(@Param("alertId") String alertId);
|
AiAlert queryByAlertId(@Param("alertId") String alertId);
|
||||||
|
|
||||||
@Select(value = {"<script>" +
|
@Select(value = {"<script>" +
|
||||||
"SELECT a.*, r.name AS roi_name FROM wvp_ai_alert a " +
|
"SELECT a.*, r.name AS roi_name, sp.gb_name AS camera_name FROM wvp_ai_alert a " +
|
||||||
"LEFT JOIN wvp_ai_roi r ON a.roi_id = r.roi_id " +
|
"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 " +
|
||||||
"WHERE 1=1 " +
|
"WHERE 1=1 " +
|
||||||
"<if test='cameraId != null'> AND a.camera_id=#{cameraId}</if> " +
|
"<if test='cameraId != null'> AND a.camera_id=#{cameraId}</if> " +
|
||||||
"<if test='alertType != null'> AND a.alert_type=#{alertType}</if> " +
|
"<if test='alertType != null'> AND a.alert_type=#{alertType}</if> " +
|
||||||
@@ -34,7 +37,8 @@ public interface AiAlertMapper {
|
|||||||
"ORDER BY a.received_at DESC" +
|
"ORDER BY a.received_at DESC" +
|
||||||
"</script>"})
|
"</script>"})
|
||||||
@Results({
|
@Results({
|
||||||
@Result(property = "roiName", column = "roi_name")
|
@Result(property = "roiName", column = "roi_name"),
|
||||||
|
@Result(property = "cameraName", column = "camera_name")
|
||||||
})
|
})
|
||||||
List<AiAlert> queryList(@Param("cameraId") String cameraId,
|
List<AiAlert> queryList(@Param("cameraId") String cameraId,
|
||||||
@Param("alertType") String alertType,
|
@Param("alertType") String alertType,
|
||||||
|
|||||||
Reference in New Issue
Block a user