web-01-api/src/entities/manual.entity.ts
2026-06-22 10:26:29 +08:00

79 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
/**
* 使用手册表 manual
* - 自引用 parentId 实现多级树形结构
* - type=0 为目录节点(无 contenttype=1 为文档节点(有 content
*/
@Entity('manual')
export class Manual {
/** 主键ID */
@PrimaryGeneratedColumn({ type: 'int', unsigned: true })
id: number;
/** 父节点IDNULL 表示根节点 */
@Column({
name: 'parent_id',
type: 'int',
unsigned: true,
nullable: true,
comment: '父节点IDNULL=根节点',
})
parentId: number | null;
/** 标题 */
@Column({ type: 'varchar', length: 200, comment: '标题' })
title: string;
/** 节点类型0=目录 1=文档 */
@Column({
type: 'tinyint',
default: 1,
comment: '类型0=目录节点 1=文档节点',
})
type: number;
/** 文档正文(富文本 HTML 或 Markdown目录节点为 null */
@Column({
type: 'longtext',
nullable: true,
comment: '文档正文(目录节点为空)',
})
content: string | null;
/** 正文格式html=富文本 markdown=Markdown */
@Column({
name: 'content_format',
type: 'varchar',
length: 10,
default: 'html',
comment: '正文格式html=富文本 markdown=Markdown',
})
contentFormat: 'html' | 'markdown';
/** 排序值,越小越靠前 */
@Column({ type: 'int', default: 0, comment: '排序值' })
sort: number;
/** 是否显示1显示 0隐藏 */
@Column({
name: 'is_show',
type: 'tinyint',
default: 1,
comment: '是否显示 1是0否',
})
isShow: number;
@CreateDateColumn({ name: 'created_at', type: 'datetime' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at', type: 'datetime' })
updatedAt: Date;
}