43 lines
781 B
TypeScript
43 lines
781 B
TypeScript
/**
|
|
* @description 字典
|
|
* @author ZKS
|
|
* @date 2025-11-27
|
|
*/
|
|
import { DictItem } from './dict_item.entity';
|
|
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
|
|
@Entity()
|
|
export class Dict {
|
|
// 主键
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({comment: '字典显示名称'})
|
|
title: string;
|
|
// 字典名称
|
|
@Column({ unique: true, comment: '字典名称' })
|
|
name: string;
|
|
|
|
// 字典项
|
|
@OneToMany(() => DictItem, item => item.dict)
|
|
items: DictItem[];
|
|
|
|
// 是否可删除
|
|
@Column({ default: true, comment: '是否可删除' })
|
|
deletable: boolean;
|
|
// 创建时间
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
// 更新时间
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|