feature/screen-management #211

Merged
kjs merged 3 commits from feature/screen-management into main 2025-11-17 16:00:06 +09:00
3 changed files with 43 additions and 30 deletions

View File

@ -144,6 +144,19 @@ export class TableManagementService {
logger.info(
`컬럼 정보 캐시에서 조회: ${tableName}, ${cachedResult.columns.length}/${cachedResult.total}`
);
// 디버깅: 캐시된 currency_code 확인
const cachedCurrency = cachedResult.columns.find(
(col: any) => col.columnName === "currency_code"
);
if (cachedCurrency) {
console.log(`💾 [캐시] currency_code:`, {
columnName: cachedCurrency.columnName,
inputType: cachedCurrency.inputType,
webType: cachedCurrency.webType,
});
}
return cachedResult;
}
@ -165,10 +178,6 @@ export class TableManagementService {
const offset = (page - 1) * size;
// 🔥 company_code가 있으면 table_type_columns 조인하여 회사별 inputType 가져오기
console.log(
`🔍 [getColumnList] 시작: table=${tableName}, company=${companyCode}`
);
const rawColumns = companyCode
? await query<any>(
`SELECT
@ -256,22 +265,6 @@ export class TableManagementService {
[tableName, size, offset]
);
// 디버깅: currency_code 확인
const currencyCol = rawColumns.find(
(col: any) => col.columnName === "currency_code"
);
if (currencyCol) {
console.log(`🎯 [getColumnList] currency_code 원본 쿼리 결과:`, {
columnName: currencyCol.columnName,
inputType: currencyCol.inputType,
ttc_input_type: currencyCol.ttc_input_type,
cl_input_type: currencyCol.cl_input_type,
webType: currencyCol.webType,
});
} else {
console.log(`⚠️ [getColumnList] currency_code가 rawColumns에 없음`);
}
// 🆕 category_column_mapping 조회
const tableExistsResult = await query<any>(
`SELECT EXISTS (
@ -804,8 +797,13 @@ export class TableManagementService {
]
);
// 🔥 캐시 무효화: 해당 테이블의 컬럼 캐시 삭제
const cacheKeyPattern = `${CacheKeys.TABLE_COLUMNS(tableName, 1, 1000)}_${companyCode}`;
cache.delete(cacheKeyPattern);
cache.delete(CacheKeys.TABLE_COLUMN_COUNT(tableName));
logger.info(
`컬럼 입력 타입 설정 완료: ${tableName}.${columnName} = ${inputType}, company: ${companyCode}`
`컬럼 입력 타입 설정 완료: ${tableName}.${columnName} = ${inputType}, company: ${companyCode} (캐시 무효화 완료)`
);
} catch (error) {
logger.error(

View File

@ -92,12 +92,22 @@ export const SelectedItemsDetailInputComponent: React.FC<SelectedItemsDetailInpu
// 🆕 필드에 codeCategory가 있으면 자동으로 옵션 로드
useEffect(() => {
const loadCodeOptions = async () => {
console.log("🔄 [loadCodeOptions] 시작:", {
additionalFields: componentConfig.additionalFields,
targetTable: componentConfig.targetTable,
});
// 🆕 code/category 타입 필드 + codeCategory가 있는 필드 모두 처리
const codeFields = componentConfig.additionalFields?.filter(
(field) => field.inputType === "code" || field.inputType === "category"
);
if (!codeFields || codeFields.length === 0) return;
console.log("🔍 [loadCodeOptions] code/category 필드:", codeFields);
if (!codeFields || codeFields.length === 0) {
console.log("⚠️ [loadCodeOptions] code/category 타입 필드가 없습니다");
return;
}
const newOptions: Record<string, Array<{ label: string; value: string }>> = { ...codeOptions };
@ -338,15 +348,17 @@ export const SelectedItemsDetailInputComponent: React.FC<SelectedItemsDetailInpu
</SelectTrigger>
<SelectContent>
{categoryOptions && categoryOptions.length > 0 ? (
categoryOptions.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))
categoryOptions
.filter((option) => option.value !== "")
.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))
) : (
<SelectItem value="" disabled>
<div className="py-6 text-center text-xs text-muted-foreground">
...
</SelectItem>
</div>
)}
</SelectContent>
</Select>
@ -374,7 +386,7 @@ export const SelectedItemsDetailInputComponent: React.FC<SelectedItemsDetailInpu
<SelectValue placeholder={field.placeholder || "선택하세요"} />
</SelectTrigger>
<SelectContent>
{field.options?.map((option) => (
{field.options?.filter((option) => option.value !== "").map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>

View File

@ -216,6 +216,7 @@ export const DynamicComponentConfigPanel: React.FC<ComponentConfigPanelProps> =
columnName: col.columnName || col.column_name,
columnLabel: col.displayName || col.columnLabel || col.column_label || col.columnName || col.column_name,
dataType: col.dataType || col.data_type || col.dbType,
inputType: col.inputType || col.input_type, // 🆕 inputType 추가
}));
console.log("✅ 원본 테이블 컬럼 초기 로드 완료:", columns.length);
@ -238,6 +239,8 @@ export const DynamicComponentConfigPanel: React.FC<ComponentConfigPanelProps> =
columnName: col.columnName || col.column_name,
columnLabel: col.displayName || col.columnLabel || col.column_label || col.columnName || col.column_name,
dataType: col.dataType || col.data_type || col.dbType,
inputType: col.inputType || col.input_type, // 🆕 inputType 추가
codeCategory: col.codeCategory || col.code_category, // 🆕 codeCategory 추가
}));
console.log("✅ 대상 테이블 컬럼 초기 로드 완료:", columns.length);