feat: 품목 마스터 소스 매핑 기능 추가

- ItemField 모델: 소스 매핑 컬럼 추가 (source_table, source_column 등)
- ItemPage 모델: source_table 컬럼 추가
- ItemDataService: 동적 데이터 조회 서비스
- ItemMasterApi Swagger 업데이트
- ItemTypeSeeder: 품목 유형 시더
- 스펙 문서: ITEM_MASTER_FIELD_INTEGRATION_PLAN.md
This commit is contained in:
2025-12-09 09:39:16 +09:00
parent 46d4c30880
commit bf92b37ff6
8 changed files with 1950 additions and 370 deletions

View File

@@ -35,6 +35,11 @@ class ItemField extends Model
'created_by',
'updated_by',
'deleted_by',
// 내부용 매핑 컬럼
'source_table',
'source_column',
'storage_type',
'json_path',
];
protected $casts = [
@@ -54,9 +59,17 @@ class ItemField extends Model
'locked_at' => 'datetime',
];
/**
* API 응답에서 제외할 컬럼 (내부용)
*/
protected $hidden = [
'deleted_by',
'deleted_at',
// 내부용 매핑 컬럼 - API 응답에서 제외
'source_table',
'source_column',
'storage_type',
'json_path',
];
/**
@@ -95,4 +108,28 @@ public function allParentRelationships()
return EntityRelationship::where('child_type', EntityRelationship::TYPE_FIELD)
->where('child_id', $this->id);
}
/**
* 시스템 필드 여부 확인 (DB 컬럼과 매핑된 필드)
*/
public function isSystemField(): bool
{
return ! is_null($this->source_table) && ! is_null($this->source_column);
}
/**
* 컬럼 저장 방식 여부 확인
*/
public function isColumnStorage(): bool
{
return $this->storage_type === 'column';
}
/**
* JSON 저장 방식 여부 확인
*/
public function isJsonStorage(): bool
{
return $this->storage_type === 'json';
}
}