fix: getColumnInputTypes가 column_labels 테이블 조회하도록 수정
- 기존: table_type_columns 테이블 조회 (잘못된 테이블) - 수정: column_labels 테이블 조회 (올바른 테이블) - 이제 테이블 관리에서 설정한 input_type이 정확하게 반영됨
This commit is contained in:
parent
1c571ee3c3
commit
8a77e6d33c
|
|
@ -2980,20 +2980,20 @@ export class TableManagementService {
|
||||||
try {
|
try {
|
||||||
logger.info(`컬럼 입력타입 정보 조회: ${tableName}`);
|
logger.info(`컬럼 입력타입 정보 조회: ${tableName}`);
|
||||||
|
|
||||||
// table_type_columns에서 입력타입 정보 조회
|
// column_labels에서 입력타입 정보 조회
|
||||||
const rawInputTypes = await query<any>(
|
const rawInputTypes = await query<any>(
|
||||||
`SELECT
|
`SELECT
|
||||||
ttc.column_name as "columnName",
|
cl.column_name as "columnName",
|
||||||
ttc.column_name as "displayName",
|
cl.column_label as "displayName",
|
||||||
COALESCE(ttc.input_type, 'text') as "inputType",
|
COALESCE(cl.input_type, 'text') as "inputType",
|
||||||
COALESCE(ttc.detail_settings, '{}') as "detailSettings",
|
'{}'::jsonb as "detailSettings",
|
||||||
ttc.is_nullable as "isNullable",
|
ic.is_nullable as "isNullable",
|
||||||
ic.data_type as "dataType"
|
ic.data_type as "dataType"
|
||||||
FROM table_type_columns ttc
|
FROM column_labels cl
|
||||||
LEFT JOIN information_schema.columns ic
|
LEFT JOIN information_schema.columns ic
|
||||||
ON ttc.table_name = ic.table_name AND ttc.column_name = ic.column_name
|
ON cl.table_name = ic.table_name AND cl.column_name = ic.column_name
|
||||||
WHERE ttc.table_name = $1
|
WHERE cl.table_name = $1
|
||||||
ORDER BY ttc.display_order, ttc.column_name`,
|
ORDER BY cl.column_name`,
|
||||||
[tableName]
|
[tableName]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,9 +287,11 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
|
|
||||||
// 컬럼 입력 타입 정보 가져오기
|
// 컬럼 입력 타입 정보 가져오기
|
||||||
const inputTypes = await tableTypeApi.getColumnInputTypes(tableConfig.selectedTable);
|
const inputTypes = await tableTypeApi.getColumnInputTypes(tableConfig.selectedTable);
|
||||||
|
console.log("📋 테이블의 inputType 정보:", tableConfig.selectedTable, inputTypes);
|
||||||
const inputTypeMap: Record<string, string> = {};
|
const inputTypeMap: Record<string, string> = {};
|
||||||
inputTypes.forEach((col: any) => {
|
inputTypes.forEach((col: any) => {
|
||||||
inputTypeMap[col.columnName] = col.inputType;
|
inputTypeMap[col.columnName] = col.inputType;
|
||||||
|
console.log(` - ${col.columnName}: ${col.inputType}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
tableColumnCache.set(cacheKey, {
|
tableColumnCache.set(cacheKey, {
|
||||||
|
|
@ -659,6 +661,7 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
// inputType 기반 포맷팅 (columnMeta에서 가져온 inputType 우선)
|
// inputType 기반 포맷팅 (columnMeta에서 가져온 inputType 우선)
|
||||||
const inputType = meta?.inputType || column.inputType;
|
const inputType = meta?.inputType || column.inputType;
|
||||||
if (inputType === "number" || inputType === "decimal") {
|
if (inputType === "number" || inputType === "decimal") {
|
||||||
|
console.log(`✅ 숫자 포맷팅 적용: ${column.columnName} = ${value} (inputType: ${inputType})`);
|
||||||
if (value !== null && value !== undefined && value !== "") {
|
if (value !== null && value !== undefined && value !== "") {
|
||||||
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
||||||
if (!isNaN(numValue)) {
|
if (!isNaN(numValue)) {
|
||||||
|
|
@ -666,6 +669,12 @@ export const TableListComponent: React.FC<TableListComponentProps> = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return String(value);
|
return String(value);
|
||||||
|
} else if (value !== null && value !== undefined && value !== "") {
|
||||||
|
// 숫자처럼 보이지만 inputType이 설정 안된 경우
|
||||||
|
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
||||||
|
if (!isNaN(numValue) && typeof value === "string" && /^\d+$/.test(value)) {
|
||||||
|
console.log(`⚠️ ${column.columnName}은 숫자 값이지만 inputType이 '${inputType}'로 설정되어 있어 포맷팅 안 됨`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (column.format) {
|
switch (column.format) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue