import { ApiHideProperty, ApiProperty } from '@nestjs/swagger'; import { Column, Entity, JoinTable, ManyToMany, Relation } from 'typeorm'; import { CommonEntity } from '~/common/entity/common.entity'; import { Storage } from '../tools/storage/storage.entity'; @Entity({ name: 'product' }) export class ProductEntity extends CommonEntity { @Column({ name: 'name', type: 'varchar', unique: true, length: 255, comment: '产品名称' }) @ApiProperty({ description: '产品名称' }) name: string; @Column({ name: 'is_delete', type: 'tinyint', default: 0, comment: '是否删除' }) @ApiProperty({ description: '删除状态:0未删除,1已删除' }) isDelete: number; @ManyToMany(() => Storage, storage => storage.products) @JoinTable({ name: 'product_storage', joinColumn: { name: 'product_id', referencedColumnName: 'id' }, inverseJoinColumn: { name: 'file_id', referencedColumnName: 'id' } }) files: Relation; }