feat(aiot): 告警详情显示ROI名称而非bbox坐标
- AiAlert实体类添加roiName字段 - Mapper查询时LEFT JOIN wvp_ai_roi表获取ROI名称 - 前端详情页显示'检测区域:ROI名称',删除'(bbox)' Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,9 @@ public class AiAlert {
|
|||||||
@Schema(description = "ROI区域ID")
|
@Schema(description = "ROI区域ID")
|
||||||
private String roiId;
|
private String roiId;
|
||||||
|
|
||||||
|
@Schema(description = "ROI区域名称(关联查询)")
|
||||||
|
private String roiName;
|
||||||
|
|
||||||
@Schema(description = "绑定ID")
|
@Schema(description = "绑定ID")
|
||||||
private String bindId;
|
private String bindId;
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,27 @@ 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 * FROM wvp_ai_alert WHERE alert_id=#{alertId}")
|
@Select("SELECT a.*, r.name AS roi_name FROM wvp_ai_alert a " +
|
||||||
|
"LEFT JOIN wvp_ai_roi r ON a.roi_id = r.roi_id " +
|
||||||
|
"WHERE a.alert_id=#{alertId}")
|
||||||
|
@Results({
|
||||||
|
@Result(property = "roiName", column = "roi_name")
|
||||||
|
})
|
||||||
AiAlert queryByAlertId(@Param("alertId") String alertId);
|
AiAlert queryByAlertId(@Param("alertId") String alertId);
|
||||||
|
|
||||||
@Select(value = {"<script>" +
|
@Select(value = {"<script>" +
|
||||||
"SELECT * FROM wvp_ai_alert WHERE 1=1 " +
|
"SELECT a.*, r.name AS roi_name FROM wvp_ai_alert a " +
|
||||||
"<if test='cameraId != null'> AND camera_id=#{cameraId}</if> " +
|
"LEFT JOIN wvp_ai_roi r ON a.roi_id = r.roi_id " +
|
||||||
"<if test='alertType != null'> AND alert_type=#{alertType}</if> " +
|
"WHERE 1=1 " +
|
||||||
"<if test='startTime != null'> AND received_at >= #{startTime}</if> " +
|
"<if test='cameraId != null'> AND a.camera_id=#{cameraId}</if> " +
|
||||||
"<if test='endTime != null'> AND received_at <= #{endTime}</if> " +
|
"<if test='alertType != null'> AND a.alert_type=#{alertType}</if> " +
|
||||||
"ORDER BY received_at DESC" +
|
"<if test='startTime != null'> AND a.received_at >= #{startTime}</if> " +
|
||||||
|
"<if test='endTime != null'> AND a.received_at <= #{endTime}</if> " +
|
||||||
|
"ORDER BY a.received_at DESC" +
|
||||||
"</script>"})
|
"</script>"})
|
||||||
|
@Results({
|
||||||
|
@Result(property = "roiName", column = "roi_name")
|
||||||
|
})
|
||||||
List<AiAlert> queryList(@Param("cameraId") String cameraId,
|
List<AiAlert> queryList(@Param("cameraId") String cameraId,
|
||||||
@Param("alertType") String alertType,
|
@Param("alertType") String alertType,
|
||||||
@Param("startTime") String startTime,
|
@Param("startTime") String startTime,
|
||||||
|
|||||||
Reference in New Issue
Block a user