61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
||
import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, Relation } from 'typeorm';
|
||
import { CommonEntity } from '~/common/entity/common.entity';
|
||
import { ProductEntity } from '../product/product.entity';
|
||
import { ProjectEntity } from '../project/project.entity';
|
||
|
||
@Entity({ name: 'materials_inventory' })
|
||
export class MaterialsInventoryEntity extends CommonEntity {
|
||
@Column({
|
||
name: 'project_id',
|
||
type: 'int',
|
||
comment: '项目'
|
||
})
|
||
@ApiProperty({ description: '项目' })
|
||
projectId: number;
|
||
|
||
@Column({
|
||
name: 'product_id',
|
||
type: 'int',
|
||
comment: '产品'
|
||
})
|
||
@ApiProperty({ description: '产品' })
|
||
productId: number;
|
||
|
||
@Column({
|
||
name: 'quantity',
|
||
type: 'int',
|
||
default: 0,
|
||
comment: '库存产品数量'
|
||
})
|
||
@ApiProperty({ description: '库存产品数量' })
|
||
quantity: number;
|
||
|
||
@Column({
|
||
name: 'unit_price',
|
||
type: 'decimal',
|
||
precision: 15,
|
||
default: 0,
|
||
scale: 10,
|
||
comment: '库存产品单价'
|
||
})
|
||
@ApiProperty({ description: '库存产品单价' })
|
||
unitPrice: number;
|
||
|
||
@Column({ name: 'remark', type: 'varchar', length: 255, comment: '备注', nullable: true })
|
||
@ApiProperty({ description: '备注' })
|
||
remark: string;
|
||
|
||
@Column({ name: 'is_delete', type: 'tinyint', default: 0, comment: '是否删除' })
|
||
@ApiProperty({ description: '删除状态:0未删除,1已删除' })
|
||
isDelete: number;
|
||
|
||
@ManyToOne(() => ProjectEntity)
|
||
@JoinColumn({ name: 'project_id' })
|
||
project: ProjectEntity;
|
||
|
||
@ManyToOne(() => ProductEntity)
|
||
@JoinColumn({ name: 'product_id' })
|
||
product: ProductEntity;
|
||
}
|