import { ApiProperty } from '@midwayjs/swagger'; import { Entity, PrimaryGeneratedColumn, Column, ManyToMany } from 'typeorm'; import { Site } from './site.entity'; import { StockPoint } from './stock_point.entity'; @Entity('area') export class Area { @PrimaryGeneratedColumn() id: number; @ApiProperty({ description: '名称' }) @Column() name: string; @ApiProperty({ description: '编码' }) @Column({ unique: true }) code: string; @ManyToMany(() => Site, site => site.areas) sites: Site[]; @ManyToMany(() => StockPoint, stockPoint => stockPoint.areas) stockPoints: StockPoint[]; }