feat(ai): 添加 ai_suggestion 和 ai_risk_threshold SeaORM Entity
This commit is contained in:
25
crates/erp-ai/src/entity/ai_risk_threshold.rs
Normal file
25
crates/erp-ai/src/entity/ai_risk_threshold.rs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
use sea_orm::entity::prelude::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||||
|
#[sea_orm(table_name = "ai_risk_threshold")]
|
||||||
|
pub struct Model {
|
||||||
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
|
pub id: Uuid,
|
||||||
|
pub tenant_id: Uuid,
|
||||||
|
pub metric_name: String,
|
||||||
|
pub low_threshold: Option<serde_json::Value>,
|
||||||
|
pub medium_threshold: Option<serde_json::Value>,
|
||||||
|
pub high_threshold: Option<serde_json::Value>,
|
||||||
|
pub created_at: DateTimeUtc,
|
||||||
|
pub updated_at: DateTimeUtc,
|
||||||
|
pub created_by: Option<Uuid>,
|
||||||
|
pub updated_by: Option<Uuid>,
|
||||||
|
pub deleted_at: Option<DateTimeUtc>,
|
||||||
|
pub version_lock: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
pub enum Relation {}
|
||||||
|
|
||||||
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
30
crates/erp-ai/src/entity/ai_suggestion.rs
Normal file
30
crates/erp-ai/src/entity/ai_suggestion.rs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
use sea_orm::entity::prelude::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||||
|
#[sea_orm(table_name = "ai_suggestion")]
|
||||||
|
pub struct Model {
|
||||||
|
#[sea_orm(primary_key, auto_increment = false)]
|
||||||
|
pub id: Uuid,
|
||||||
|
pub tenant_id: Uuid,
|
||||||
|
pub analysis_id: Uuid,
|
||||||
|
pub suggestion_type: String,
|
||||||
|
pub risk_level: String,
|
||||||
|
pub params: serde_json::Value,
|
||||||
|
pub status: String,
|
||||||
|
pub workflow_instance_id: Option<Uuid>,
|
||||||
|
pub action_result: Option<serde_json::Value>,
|
||||||
|
pub baseline_snapshot: Option<serde_json::Value>,
|
||||||
|
pub reanalysis_id: Option<Uuid>,
|
||||||
|
pub created_at: DateTimeUtc,
|
||||||
|
pub updated_at: DateTimeUtc,
|
||||||
|
pub created_by: Option<Uuid>,
|
||||||
|
pub updated_by: Option<Uuid>,
|
||||||
|
pub deleted_at: Option<DateTimeUtc>,
|
||||||
|
pub version_lock: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
pub enum Relation {}
|
||||||
|
|
||||||
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
pub mod ai_analysis;
|
pub mod ai_analysis;
|
||||||
pub mod ai_prompt;
|
pub mod ai_prompt;
|
||||||
|
pub mod ai_risk_threshold;
|
||||||
|
pub mod ai_suggestion;
|
||||||
pub mod ai_usage;
|
pub mod ai_usage;
|
||||||
|
|||||||
Reference in New Issue
Block a user