Skip to main content

tdm_server_rust/sea_entity/
mangaauthor.rs

1//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.20
2
3use sea_orm::entity::prelude::*;
4use serde::{Deserialize, Serialize};
5
6/// mangaauthor 表的 SeaORM 行模型。
7/// 漫画作者关联表,连接漫画与作者,并区分原作作者、作画作者等职责类型。
8#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
9#[sea_orm(table_name = "mangaauthor")]
10pub struct Model {
11    /// 漫画作者关联主键,自增 ID,用于唯一定位一条作者绑定记录。 对应数据库列 `Id`。
12    #[sea_orm(column_name = "Id", primary_key)]
13    pub id: i32,
14    /// 漫画 ID,指向 mangatb,表示该作者参与的作品。 对应数据库列 `mangaId`。
15    #[sea_orm(column_name = "mangaId")]
16    pub manga_id: i32,
17    /// 作者 ID,指向 authortb,表示关联的作者记录。 对应数据库列 `authorId`。
18    #[sea_orm(column_name = "authorId")]
19    pub author_id: i32,
20    /// 作者职责类型,1 原作或作者,2 作画作者,用于区分多作者作品中的分工。 对应数据库列 `type`。
21    pub r#type: i32,
22}
23
24/// SeaORM 关系枚举。用于声明该实体可通过 SeaORM 自动推导的跨表关联。
25#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
26pub enum Relation {
27    /// 所属漫画主表关系,通过 mangaId 关联 mangatb.Id。
28    #[sea_orm(
29        belongs_to = "super::mangatb::Entity",
30        from = "Column::MangaId",
31        to = "super::mangatb::Column::Id"
32    )]
33    Mangatb,
34    /// 所属作者主表关系,通过 authorId 关联 authortb.Id。
35    #[sea_orm(
36        belongs_to = "super::authortb::Entity",
37        from = "Column::AuthorId",
38        to = "super::authortb::Column::Id"
39    )]
40    Authortb,
41}
42
43/// 使用 SeaORM 默认 ActiveModel 行为,当前不覆盖插入、更新或删除钩子。
44impl ActiveModelBehavior for ActiveModel {}