// src/entity/StockRecord.ts import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, } from 'typeorm'; import { StockRecordOperationType } from '../enums/base.enum'; import { ApiProperty } from '@midwayjs/swagger'; @Entity('stock_record') export class StockRecord { @ApiProperty({ type: Number }) @PrimaryGeneratedColumn() id: number; @ApiProperty({ type: Number }) @Column() stockPointId: number; @ApiProperty({ type: String }) @Column() productSku: string; @ApiProperty({ type: StockRecordOperationType }) @Column({ type: 'enum', enum: StockRecordOperationType }) operationType: StockRecordOperationType; @ApiProperty({ type: Number }) @Column() quantityChange: number; @ApiProperty() @Column() operatorId: number; @ApiProperty({ example: '2022-12-12 11:11:11', description: '创建时间', required: true, }) @CreateDateColumn() createdAt: Date; @ApiProperty({ type: String }) @Column({ nullable: true }) note: string; }