import {
  Column,
  UpdateDateColumn,
  CreateDateColumn,
  VersionColumn,
} from 'typeorm';

export abstract class BaseEntity {
  @CreateDateColumn({ name: 'create_time', comment: '创建时间' })
  createTime: Date;

  @Column({ comment: '创建人', default: 'SYSTEM' })
  creator: string;

  @UpdateDateColumn({
    name: 'update_time',
    comment: '更新时间',
  })
  updateTime: Date;

  @Column({ comment: '更新人', default: 'SYSTEM' })
  updater: string;

  @Column({
    default: 0,
    select: false,
    name: 'del_flag',
    comment: '是否删除：0否/1是',
  })
  delFlag: number;

  @Column({ nullable: true, comment: '备注说明' })
  remarks: string;

  @VersionColumn({ select: false, comment: '更新版本' })
  version: number;
}
