- erp-ai entity 表名对齐数据库: ai_prompt/ai_analysis/ai_usage - stats_service: count() u64 → i64 显式转换 - health_data_service: 危急值检测 i32 比较修正 + req 所有权修复 - points_service: check_version 参数修正 - diagnosis_service: 补充 ActiveModelTrait 导入 - module.rs: start_overdue_checker 参数改为 DatabaseConnection - module.rs: register_handlers_with_state 避免 move
25 lines
671 B
Rust
25 lines
671 B
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "ai_usage")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub tenant_id: Uuid,
|
|
pub provider: String,
|
|
pub model: String,
|
|
pub analysis_type: String,
|
|
pub input_tokens: i32,
|
|
pub output_tokens: i32,
|
|
pub duration_ms: i32,
|
|
pub cost_cents: i32,
|
|
pub is_cache_hit: bool,
|
|
pub created_at: DateTimeUtc,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|