oa_based/src/modules/system/menu/menu.entity.ts

56 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-02-28 17:02:46 +08:00
import { Column, Entity, ManyToMany, Relation } from 'typeorm';
2024-02-28 08:32:35 +08:00
2024-02-28 17:02:46 +08:00
import { CommonEntity } from '~/common/entity/common.entity';
2024-02-28 08:32:35 +08:00
2024-02-28 17:02:46 +08:00
import { RoleEntity } from '../role/role.entity';
2024-02-28 08:32:35 +08:00
@Entity({ name: 'sys_menu' })
export class MenuEntity extends CommonEntity {
@Column({ name: 'parent_id', nullable: true })
2024-02-28 17:02:46 +08:00
parentId: number;
2024-02-28 08:32:35 +08:00
@Column()
2024-02-28 17:02:46 +08:00
name: string;
2024-02-28 08:32:35 +08:00
@Column({ nullable: true })
2024-02-28 17:02:46 +08:00
path: string;
2024-02-28 08:32:35 +08:00
@Column({ nullable: true })
2024-02-28 17:02:46 +08:00
permission: string;
2024-02-28 08:32:35 +08:00
@Column({ type: 'tinyint', default: 0 })
2024-02-28 17:02:46 +08:00
type: number;
2024-02-28 08:32:35 +08:00
@Column({ nullable: true, default: '' })
2024-02-28 17:02:46 +08:00
icon: string;
2024-02-28 08:32:35 +08:00
@Column({ name: 'order_no', type: 'int', nullable: true, default: 0 })
2024-02-28 17:02:46 +08:00
orderNo: number;
2024-02-28 08:32:35 +08:00
@Column({ name: 'component', nullable: true })
2024-02-28 17:02:46 +08:00
component: string;
2024-02-28 08:32:35 +08:00
@Column({ name: 'is_ext', type: 'boolean', default: false })
2024-02-28 17:02:46 +08:00
isExt: boolean;
2024-02-28 08:32:35 +08:00
@Column({ name: 'ext_open_mode', type: 'tinyint', default: 1 })
2024-02-28 17:02:46 +08:00
extOpenMode: number;
2024-02-28 08:32:35 +08:00
@Column({ name: 'keep_alive', type: 'tinyint', default: 1 })
2024-02-28 17:02:46 +08:00
keepAlive: number;
2024-02-28 08:32:35 +08:00
@Column({ type: 'tinyint', default: 1 })
2024-02-28 17:02:46 +08:00
show: number;
2024-02-28 08:32:35 +08:00
@Column({ name: 'active_menu', nullable: true })
2024-02-28 17:02:46 +08:00
activeMenu: string;
2024-02-28 08:32:35 +08:00
@Column({ type: 'tinyint', default: 1 })
2024-02-28 17:02:46 +08:00
status: number;
2024-02-28 08:32:35 +08:00
@ManyToMany(() => RoleEntity, role => role.menus, {
2024-02-29 09:29:03 +08:00
onDelete: 'CASCADE'
2024-02-28 08:32:35 +08:00
})
2024-02-28 17:02:46 +08:00
roles: Relation<RoleEntity[]>;
2024-02-28 08:32:35 +08:00
}