Files
hms/crates/erp-workflow/src/entity/process_definition.rs
iven 96a4287272 docs(workflow): clarify version vs version_field naming in process_definition
Add doc comments to distinguish the business version field (key-based
revision counter, currently fixed at 1) from the optimistic lock field
(version_field). Renaming requires a DB migration so deferred to later.
2026-04-11 16:20:32 +08:00

44 lines
1.4 KiB
Rust
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.
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "process_definitions")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub tenant_id: Uuid,
pub name: String,
pub key: String,
/// 业务版本号(如同一 key 可存在多个版本),当前固定为 1未来支持发布新版本时递增。
pub version: i32,
#[serde(skip_serializing_if = "Option::is_none")]
pub category: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub nodes: serde_json::Value,
pub edges: serde_json::Value,
pub status: String,
pub created_at: DateTimeUtc,
pub updated_at: DateTimeUtc,
pub created_by: Uuid,
pub updated_by: Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub deleted_at: Option<DateTimeUtc>,
/// 乐观锁版本号ERP 标准审计字段),每次更新递增。
pub version_field: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::process_instance::Entity")]
ProcessInstance,
}
impl Related<super::process_instance::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProcessInstance.def()
}
}
impl ActiveModelBehavior for ActiveModel {}