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")
|
||||
private String roiId;
|
||||
|
||||
@Schema(description = "ROI区域名称(关联查询)")
|
||||
private String roiName;
|
||||
|
||||
@Schema(description = "绑定ID")
|
||||
private String bindId;
|
||||
|
||||
|
||||
@@ -15,17 +15,27 @@ public interface AiAlertMapper {
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
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);
|
||||
|
||||
@Select(value = {"<script>" +
|
||||
"SELECT * FROM wvp_ai_alert WHERE 1=1 " +
|
||||
"<if test='cameraId != null'> AND camera_id=#{cameraId}</if> " +
|
||||
"<if test='alertType != null'> AND alert_type=#{alertType}</if> " +
|
||||
"<if test='startTime != null'> AND received_at >= #{startTime}</if> " +
|
||||
"<if test='endTime != null'> AND received_at <= #{endTime}</if> " +
|
||||
"ORDER BY received_at DESC" +
|
||||
"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 1=1 " +
|
||||
"<if test='cameraId != null'> AND a.camera_id=#{cameraId}</if> " +
|
||||
"<if test='alertType != null'> AND a.alert_type=#{alertType}</if> " +
|
||||
"<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>"})
|
||||
@Results({
|
||||
@Result(property = "roiName", column = "roi_name")
|
||||
})
|
||||
List<AiAlert> queryList(@Param("cameraId") String cameraId,
|
||||
@Param("alertType") String alertType,
|
||||
@Param("startTime") String startTime,
|
||||
|
||||
Reference in New Issue
Block a user