feat: 서브 테이블 정보 및 관계 시각화 개선
- 화면 서브 테이블에서 valueField, parentFieldId, cascadingParentField, controlField 정보를 추출하는 쿼리 추가 - 서브 테이블의 관계 유형을 추론하기 위한 추가 정보 필드(originalRelationType, foreignKey, leftColumn) 포함 - 필터링에 사용되는 FK 컬럼을 TableNodeData 인터페이스에 추가하여 시각화 개선 - 관계 유형별 색상 정의 및 시각적 관계 유형 추론 함수 추가 - 화면 관계 흐름에서 서브 테이블 연결선 및 필터링 참조 정보 표시 기능 개선
This commit is contained in:
@@ -1382,6 +1382,58 @@ export const getScreenSubTables = async (req: Request, res: Response) => {
|
||||
OR sl.properties->'componentConfig'->>'field' IS NOT NULL
|
||||
OR sl.properties->>'field' IS NOT NULL
|
||||
)
|
||||
|
||||
UNION
|
||||
|
||||
-- valueField 추출 (entity-search-input, autocomplete-search-input 등에서 사용)
|
||||
SELECT
|
||||
sd.screen_id,
|
||||
sd.screen_name,
|
||||
sd.table_name as main_table,
|
||||
sl.properties->'componentConfig'->>'valueField' as column_name
|
||||
FROM screen_definitions sd
|
||||
JOIN screen_layouts sl ON sd.screen_id = sl.screen_id
|
||||
WHERE sd.screen_id = ANY($1)
|
||||
AND sl.properties->'componentConfig'->>'valueField' IS NOT NULL
|
||||
|
||||
UNION
|
||||
|
||||
-- parentFieldId 추출 (캐스케이딩 관계에서 사용)
|
||||
SELECT
|
||||
sd.screen_id,
|
||||
sd.screen_name,
|
||||
sd.table_name as main_table,
|
||||
sl.properties->'componentConfig'->>'parentFieldId' as column_name
|
||||
FROM screen_definitions sd
|
||||
JOIN screen_layouts sl ON sd.screen_id = sl.screen_id
|
||||
WHERE sd.screen_id = ANY($1)
|
||||
AND sl.properties->'componentConfig'->>'parentFieldId' IS NOT NULL
|
||||
|
||||
UNION
|
||||
|
||||
-- cascadingParentField 추출 (캐스케이딩 부모 필드)
|
||||
SELECT
|
||||
sd.screen_id,
|
||||
sd.screen_name,
|
||||
sd.table_name as main_table,
|
||||
sl.properties->'componentConfig'->>'cascadingParentField' as column_name
|
||||
FROM screen_definitions sd
|
||||
JOIN screen_layouts sl ON sd.screen_id = sl.screen_id
|
||||
WHERE sd.screen_id = ANY($1)
|
||||
AND sl.properties->'componentConfig'->>'cascadingParentField' IS NOT NULL
|
||||
|
||||
UNION
|
||||
|
||||
-- controlField 추출 (conditional-container에서 사용)
|
||||
SELECT
|
||||
sd.screen_id,
|
||||
sd.screen_name,
|
||||
sd.table_name as main_table,
|
||||
sl.properties->'componentConfig'->>'controlField' as column_name
|
||||
FROM screen_definitions sd
|
||||
JOIN screen_layouts sl ON sd.screen_id = sl.screen_id
|
||||
WHERE sd.screen_id = ANY($1)
|
||||
AND sl.properties->'componentConfig'->>'controlField' IS NOT NULL
|
||||
)
|
||||
SELECT DISTINCT
|
||||
suc.screen_id,
|
||||
@@ -1398,6 +1450,7 @@ export const getScreenSubTables = async (req: Request, res: Response) => {
|
||||
WHERE cl.reference_table IS NOT NULL
|
||||
AND cl.reference_table != ''
|
||||
AND cl.reference_table != suc.main_table
|
||||
AND cl.input_type = 'entity'
|
||||
ORDER BY suc.screen_id
|
||||
`;
|
||||
|
||||
@@ -1625,13 +1678,27 @@ export const getScreenSubTables = async (req: Request, res: Response) => {
|
||||
existingSubTable.fieldMappings!.push(newMapping);
|
||||
}
|
||||
});
|
||||
// 추가 정보도 업데이트
|
||||
if (relation?.type) {
|
||||
(existingSubTable as any).originalRelationType = relation.type;
|
||||
}
|
||||
if (relation?.foreignKey) {
|
||||
(existingSubTable as any).foreignKey = relation.foreignKey;
|
||||
}
|
||||
if (relation?.leftColumn) {
|
||||
(existingSubTable as any).leftColumn = relation.leftColumn;
|
||||
}
|
||||
} else {
|
||||
screenSubTables[screenId].subTables.push({
|
||||
tableName: subTable,
|
||||
componentType: componentType,
|
||||
relationType: 'rightPanelRelation',
|
||||
// 관계 유형 추론을 위한 추가 정보
|
||||
originalRelationType: relation?.type || 'join', // 원본 relation.type ("join" | "detail")
|
||||
foreignKey: relation?.foreignKey, // 디테일 테이블의 FK 컬럼
|
||||
leftColumn: relation?.leftColumn, // 마스터 테이블의 선택 기준 컬럼
|
||||
fieldMappings: fieldMappings.length > 0 ? fieldMappings : undefined,
|
||||
});
|
||||
} as any);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user