add sku mapping
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Hyperf\Database\Model\Relations\BelongsTo;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
/**
|
||||
* @property int $id 主键
|
||||
* @property int $company_id 公司 ID
|
||||
* @property int $platform_id 平台 ID
|
||||
* @property string $platform_product_id 平台商品 ID
|
||||
* @property string $origin_sku 客户侧匹配的 SKU 编码
|
||||
* @property int|null $origin_sku_id 关联 skus_origin.id
|
||||
* @property string|null $platform_outer_sku 平台侧使用的 SKU 编码
|
||||
* @property string|null $generation_strategy 生成策略记录
|
||||
* @property int|null $store_id 店铺 ID
|
||||
* @property int|null $warehouse_id 仓库 ID
|
||||
* @property boolean $enabled 是否启用
|
||||
* @property string|null $note 备注
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*/
|
||||
#[OA\Schema(
|
||||
schema: 'SkuMapping',
|
||||
description: 'SKU 平台映射',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer', example: 1),
|
||||
new OA\Property(property: 'company_id', type: 'integer', example: 3),
|
||||
new OA\Property(property: 'platform_id', type: 'integer', example: 1),
|
||||
new OA\Property(property: 'platform_product_id', type: 'string', example: 'ITEM-001'),
|
||||
new OA\Property(property: 'origin_sku', type: 'string', example: '0032'),
|
||||
new OA\Property(property: 'origin_sku_id', type: 'integer', nullable: true, example: 1),
|
||||
new OA\Property(property: 'platform_outer_sku', type: 'string', nullable: true, example: 'C03_0032'),
|
||||
new OA\Property(property: 'generation_strategy', type: 'string', nullable: true, example: 'prefix:C03'),
|
||||
new OA\Property(property: 'store_id', type: 'integer', nullable: true, example: 101),
|
||||
new OA\Property(property: 'warehouse_id', type: 'integer', nullable: true, example: 1),
|
||||
new OA\Property(property: 'enabled', type: 'boolean', example: true),
|
||||
new OA\Property(property: 'note', type: 'string', nullable: true, example: '用于 Shopee 马来站'),
|
||||
new OA\Property(property: 'created_at', type: 'string', format: 'date-time'),
|
||||
new OA\Property(property: 'updated_at', type: 'string', format: 'date-time'),
|
||||
]
|
||||
)]
|
||||
class SkuMapping extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'skus_mapping';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = [
|
||||
'company_id',
|
||||
'platform_id',
|
||||
'platform_product_id',
|
||||
'origin_sku',
|
||||
'origin_sku_id',
|
||||
'platform_outer_sku',
|
||||
'generation_strategy',
|
||||
'store_id',
|
||||
'warehouse_id',
|
||||
'enabled',
|
||||
'note',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = [
|
||||
'id' => 'integer',
|
||||
'company_id' => 'integer',
|
||||
'platform_id' => 'integer',
|
||||
'origin_sku_id' => 'integer',
|
||||
'store_id' => 'integer',
|
||||
'warehouse_id' => 'integer',
|
||||
'enabled' => 'boolean',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function company(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Company::class, 'company_id');
|
||||
}
|
||||
|
||||
public function platform(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Platform::class, 'platform_id');
|
||||
}
|
||||
|
||||
public function store(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Store::class, 'store_id');
|
||||
}
|
||||
|
||||
public function skuOrigin(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SkuOrigin::class, 'origin_sku_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user