|
@@ -1,16 +1,15 @@
|
|
|
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
|
|
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
+use serde::Serialize;
|
|
|
|
|
|
-#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
|
+#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize)]
|
|
|
#[sea_orm(table_name = "menu_commodity")]
|
|
|
pub struct Model {
|
|
|
#[sea_orm(primary_key)]
|
|
|
pub id: i32,
|
|
|
#[sea_orm(column_type = "Text", nullable)]
|
|
|
pub r#type: Option<String>,
|
|
|
- pub merchant_id: Option<i32>,
|
|
|
- pub store_id: Option<i32>,
|
|
|
#[sea_orm(column_type = "Text", nullable)]
|
|
|
pub name: Option<String>,
|
|
|
pub cate_id: Option<i32>,
|
|
@@ -50,6 +49,37 @@ pub struct Model {
|
|
|
}
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
|
-pub enum Relation {}
|
|
|
+pub enum Relation {
|
|
|
+ #[sea_orm(
|
|
|
+ belongs_to = "super::menu_cate::Entity",
|
|
|
+ from = "Column::CateId",
|
|
|
+ to = "super::menu_cate::Column::Id",
|
|
|
+ on_update = "NoAction",
|
|
|
+ on_delete = "NoAction"
|
|
|
+ )]
|
|
|
+ MenuCate,
|
|
|
+ #[sea_orm(has_many = "super::menu_sku::Entity")]
|
|
|
+ MenuSku,
|
|
|
+ #[sea_orm(has_many = "super::menu_spec::Entity")]
|
|
|
+ MenuSpec,
|
|
|
+}
|
|
|
+
|
|
|
+impl Related<super::menu_cate::Entity> for Entity {
|
|
|
+ fn to() -> RelationDef {
|
|
|
+ Relation::MenuCate.def()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+impl Related<super::menu_sku::Entity> for Entity {
|
|
|
+ fn to() -> RelationDef {
|
|
|
+ Relation::MenuSku.def()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+impl Related<super::menu_spec::Entity> for Entity {
|
|
|
+ fn to() -> RelationDef {
|
|
|
+ Relation::MenuSpec.def()
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|