zksu
/
API
forked from yoone/API
1
0
Fork 0
API/src/entity/product_stock_component.ent...

37 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ApiProperty } from '@midwayjs/swagger';
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { Product } from './product.entity';
// 套餐产品构成 item(sku,0013,xx20,mixed008)n--siteSkus(0013,xx20,xx)旧版数据-->product-component(0020)(套装1 5 10 20 50 100 (erp 手动创建)mixed)->(product(单品)+ quantity)->sales
// CA -> site-product -> components
// PRODUCT->compoentn一次性做完 product+关联sku
@Entity('product_stock_component')
export class ProductStockComponent {
@ApiProperty({ type: Number })
@PrimaryGeneratedColumn()
id: number;
@ApiProperty({ type: Number })
@Column()
productId: number;
// zi
@ApiProperty({ description: '组件所关联的 SKU', type: 'string' })
@Column({ type: 'varchar', length: 64 })
sku: string;
// zi
@ApiProperty({ type: Number, description: '组成数量' })
@Column({ type: 'int', default: 1 })
quantity: number;
// baba
// 多对一,组件隶属于一个产品
@ManyToOne(() => Product, (product) => product.components, { onDelete: 'CASCADE' })
product: Product;
@ApiProperty({ description: '创建时间' })
@CreateDateColumn()
createdAt: Date;
@ApiProperty({ description: '更新时间' })
@UpdateDateColumn()
updatedAt: Date;
}