Преглед изворни кода

✨ feat(store_order_refund): 新增退款订单模型及其关联

陈雪 пре 1 дан
родитељ
комит
7a35a6cefb

+ 2 - 2
src-tauri/src/models/mod.rs

@@ -1,13 +1,13 @@
 //! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
 
-pub mod prelude;
-
 pub mod menu_cate;
 pub mod menu_commodity;
 pub mod menu_sku;
 pub mod menu_sku_spec;
 pub mod menu_spec;
+pub mod prelude;
 pub mod store_area;
 pub mod store_material;
 pub mod store_order;
+pub mod store_order_refund;
 pub mod store_table;

+ 6 - 5
src-tauri/src/models/prelude.rs

@@ -2,10 +2,11 @@
 
 pub use super::menu_cate::Entity as MenuCate;
 pub use super::menu_commodity::Entity as MenuCommodity;
-// pub use super::menu_sku::Entity as MenuSku;
-// pub use super::menu_sku_spec::Entity as MenuSkuSpec;
-// pub use super::menu_spec::Entity as MenuSpec;
+pub use super::menu_sku::Entity as MenuSku;
+pub use super::menu_sku_spec::Entity as MenuSkuSpec;
+pub use super::menu_spec::Entity as MenuSpec;
 pub use super::store_area::Entity as StoreArea;
-// pub use super::store_material::Entity as StoreMaterial;
-// pub use super::store_order::Entity as StoreOrder;
+pub use super::store_material::Entity as StoreMaterial;
+pub use super::store_order::Entity as StoreOrder;
+pub use super::store_order_refund::Entity as StoreOrderRefund;
 pub use super::store_table::Entity as StoreTable;

+ 42 - 0
src-tauri/src/models/store_order_refund.rs

@@ -0,0 +1,42 @@
+//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
+
+use sea_orm::entity::prelude::*;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
+#[sea_orm(table_name = "store_order_refund")]
+pub struct Model {
+    #[sea_orm(primary_key)]
+    pub id: i32,
+    pub order_id: i32,
+    pub refund_amount: Decimal,
+    #[sea_orm(column_type = "Text")]
+    pub refund_reason: String,
+    #[sea_orm(column_type = "custom(\"DATETIME\")")]
+    pub refund_time: String,
+    #[sea_orm(column_type = "custom(\"DATETIME\")")]
+    pub create_time: String,
+    #[sea_orm(column_type = "custom(\"DATETIME\")")]
+    pub update_time: String,
+    pub status: i32,
+}
+
+#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
+pub enum Relation {
+    #[sea_orm(
+        belongs_to = "super::store_order::Entity",
+        from = "Column::OrderId",
+        to = "super::store_order::Column::Id",
+        on_update = "NoAction",
+        on_delete = "NoAction"
+    )]
+    StoreOrder,
+}
+
+impl Related<super::store_order::Entity> for Entity {
+    fn to() -> RelationDef {
+        Relation::StoreOrder.def()
+    }
+}
+
+impl ActiveModelBehavior for ActiveModel {}