1 feat: 重构触发器设计,移除触发条件并添加名称字段
2
3 - 从Trigger、DbTriggerDefinition和TriggerItem类中移除了所有条件相关的属性(Condition, Threshold, LowerBound, UpperBound)
4 - 删除了ConditionType枚举,简化了触发器逻辑
5 - 为触发器添加了Name字段,在核心模型、数据库实体和视图模型中都添加了该属性
6 - 删除了TriggerDialog界面中的变量选择和搜索功能
7 - 从TriggerDialog界面中删除了触发条件相关的UI元素
8 - 更新了TriggerDialogViewModel,移除了条件相关的验证和业务逻辑
9 - 更新了TriggersViewModel,移除了条件的初始化设置
10 - 更新了AutoMapper配置文件,增加TriggerItem与Trigger之间的映射
11 - 在TriggerEvaluationService中移除了条件判断逻辑,现在激活的触发器会直接执行动作
12 - 更新了App.xaml,移除了对已删除枚举的引用
13 - 修改了保存验证逻辑,确保触发器名称不能为空
This commit is contained in:
@@ -18,37 +18,17 @@ public class DbTriggerDefinition
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发器名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 200, IsNullable = true)]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 触发器是否处于激活状态。
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
// --- 条件部分 ---
|
||||
|
||||
/// <summary>
|
||||
/// 触发条件类型。
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(20)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public ConditionType Condition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阈值 (用于 GreaterThan, LessThan, EqualTo, NotEqualTo)。
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public double? Threshold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下限 (用于 InRange, OutOfRange)。
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public double? LowerBound { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上限 (用于 InRange, OutOfRange)。
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public double? UpperBound { get; set; }
|
||||
|
||||
// --- 动作部分 ---
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -46,6 +46,7 @@ public class MappingProfile : Profile
|
||||
|
||||
// --- 触发器映射 ---
|
||||
CreateMap<DbTriggerDefinition, Trigger>()
|
||||
.ForMember(dest => dest.Variables, opt => opt.Ignore()) // 忽略Variables属性映射,因为可能需要特殊处理
|
||||
.ReverseMap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user