CounterDroneBackend/src/CounterDrone.Core/Repository/EquipmentDeploymentRepository.cs
tian 665747a846 feat: standalone detection equipment API + task detail includes detections
IScenarioService: AddDetection/DeleteDetection/GetDetections (independent of SaveDeployment overwrite).

Repository: GetByTaskIdAndRole filters by equipment role.

TaskFullConfig.Equipment already includes detections (GetTaskDetail.GetByTaskId returns all). Frontend filters by EquipmentRole.Detection or uses GetDetections.

Tests: 4 detection CRUD tests. 212 total pass.
2026-06-15 13:30:16 +08:00

33 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.Generic;
using System.Linq;
using CounterDrone.Core.Models;
using SQLite;
namespace CounterDrone.Core.Repository
{
public class EquipmentDeploymentRepository : BaseRepository<EquipmentDeployment>
{
public EquipmentDeploymentRepository(SQLiteConnection db) : base(db) { }
public List<EquipmentDeployment> GetByTaskId(string taskId)
{
return Db.Table<EquipmentDeployment>().Where(e => e.TaskId == taskId).ToList();
}
/// <summary>按任务和角色查询装备EquipmentRole: 0=Detection, 1=LaunchPlatform</summary>
public List<EquipmentDeployment> GetByTaskIdAndRole(string taskId, int equipmentRole)
{
return Db.Table<EquipmentDeployment>()
.Where(e => e.TaskId == taskId && e.EquipmentRole == equipmentRole)
.ToList();
}
public void DeleteByTaskId(string taskId)
{
var equips = GetByTaskId(taskId);
foreach (var e in equips)
Db.Delete(e);
}
}
}