fix: 엔티티 컬럼 조인 테이블 정보 자동 가져오기 기능 추가
- loadEntityDisplayConfig에서 joinTable이 비어있을 때 Entity 조인 API로 조인 테이블 정보 자동 조회 - 조인 테이블 정보를 찾으면 entityDisplayConfig에 자동 업데이트 - 상세한 로깅으로 조인 테이블 정보 조회 과정 추적 가능
This commit is contained in:
parent
4c5e0330ef
commit
28109eb63b
|
|
@ -372,9 +372,47 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
|||
// 이미 로드된 경우 스킵
|
||||
if (entityDisplayConfigs[configKey]) return;
|
||||
|
||||
// joinTable이 비어있으면 Entity 조인 API로 조인 테이블 정보를 가져와서 설정
|
||||
let actualJoinTable = joinTable;
|
||||
if (!actualJoinTable && sourceTable) {
|
||||
try {
|
||||
console.log("🔍 조인 테이블 정보를 Entity 조인 API로 가져오기:", sourceTable);
|
||||
const entityJoinResult = await entityJoinApi.getEntityJoinColumns(sourceTable);
|
||||
|
||||
// 해당 컬럼에 대한 조인 설정 찾기
|
||||
const columnJoinConfig = entityJoinResult.availableColumns?.find(
|
||||
(col) => col.columnName === column.columnName
|
||||
);
|
||||
|
||||
if (columnJoinConfig?.joinTable) {
|
||||
actualJoinTable = columnJoinConfig.joinTable;
|
||||
console.log("✅ 조인 테이블 정보 찾음:", actualJoinTable);
|
||||
|
||||
// entityDisplayConfig 업데이트
|
||||
const updatedConfig = {
|
||||
...column.entityDisplayConfig,
|
||||
joinTable: actualJoinTable,
|
||||
};
|
||||
|
||||
// 컬럼 설정 업데이트
|
||||
const updatedColumns = config.columns?.map((col) =>
|
||||
col.columnName === column.columnName
|
||||
? { ...col, entityDisplayConfig: updatedConfig }
|
||||
: col
|
||||
);
|
||||
|
||||
if (updatedColumns) {
|
||||
handleChange("columns", updatedColumns);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Entity 조인 정보 조회 실패:", error);
|
||||
}
|
||||
}
|
||||
|
||||
// sourceTable과 joinTable이 모두 있어야 로드
|
||||
if (!sourceTable || !joinTable) {
|
||||
console.log("⚠️ sourceTable 또는 joinTable이 비어있어서 로드 스킵:", { sourceTable, joinTable });
|
||||
if (!sourceTable || !actualJoinTable) {
|
||||
console.log("⚠️ sourceTable 또는 joinTable이 비어있어서 로드 스킵:", { sourceTable, joinTable: actualJoinTable });
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +420,7 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
|||
// 기본 테이블과 조인 테이블의 컬럼 정보를 병렬로 로드
|
||||
const [sourceResult, joinResult] = await Promise.all([
|
||||
entityJoinApi.getReferenceTableColumns(sourceTable),
|
||||
entityJoinApi.getReferenceTableColumns(joinTable),
|
||||
entityJoinApi.getReferenceTableColumns(actualJoinTable),
|
||||
]);
|
||||
|
||||
const sourceColumns = sourceResult.columns || [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue