fix: 화면 복제 기능 개선 및 관련 버그 수정
- 화면 복제 기능을 개선하여 DB 구조 개편 후의 효율적인 화면 관리를 지원합니다. - 그룹 복제 시 버튼의 `targetScreenId`가 새 화면으로 매핑되지 않는 버그를 수정하였습니다. - 관련된 서비스 및 쿼리에서 `table_type_columns`를 사용하여 라벨 정보를 조회하도록 변경하였습니다. - 여러 컨트롤러 및 서비스에서 `column_labels` 대신 `table_type_columns`를 참조하도록 업데이트하였습니다.
This commit is contained in:
@@ -1682,14 +1682,11 @@ export async function getCategoryColumnsByCompany(
|
||||
) AS "tableLabel",
|
||||
ttc.column_name AS "columnName",
|
||||
COALESCE(
|
||||
cl.column_label,
|
||||
ttc.column_label,
|
||||
initcap(replace(ttc.column_name, '_', ' '))
|
||||
) AS "columnLabel",
|
||||
ttc.input_type AS "inputType"
|
||||
FROM table_type_columns ttc
|
||||
LEFT JOIN column_labels cl
|
||||
ON ttc.table_name = cl.table_name
|
||||
AND ttc.column_name = cl.column_name
|
||||
LEFT JOIN table_labels tl
|
||||
ON ttc.table_name = tl.table_name
|
||||
WHERE ttc.input_type = 'category'
|
||||
@@ -1712,14 +1709,11 @@ export async function getCategoryColumnsByCompany(
|
||||
) AS "tableLabel",
|
||||
ttc.column_name AS "columnName",
|
||||
COALESCE(
|
||||
cl.column_label,
|
||||
ttc.column_label,
|
||||
initcap(replace(ttc.column_name, '_', ' '))
|
||||
) AS "columnLabel",
|
||||
ttc.input_type AS "inputType"
|
||||
FROM table_type_columns ttc
|
||||
LEFT JOIN column_labels cl
|
||||
ON ttc.table_name = cl.table_name
|
||||
AND ttc.column_name = cl.column_name
|
||||
LEFT JOIN table_labels tl
|
||||
ON ttc.table_name = tl.table_name
|
||||
WHERE ttc.input_type = 'category'
|
||||
@@ -1806,14 +1800,11 @@ export async function getCategoryColumnsByMenu(
|
||||
) AS "tableLabel",
|
||||
ttc.column_name AS "columnName",
|
||||
COALESCE(
|
||||
cl.column_label,
|
||||
ttc.column_label,
|
||||
initcap(replace(ttc.column_name, '_', ' '))
|
||||
) AS "columnLabel",
|
||||
ttc.input_type AS "inputType"
|
||||
FROM table_type_columns ttc
|
||||
LEFT JOIN column_labels cl
|
||||
ON ttc.table_name = cl.table_name
|
||||
AND ttc.column_name = cl.column_name
|
||||
LEFT JOIN table_labels tl
|
||||
ON ttc.table_name = tl.table_name
|
||||
WHERE ttc.input_type = 'category'
|
||||
@@ -1836,14 +1827,11 @@ export async function getCategoryColumnsByMenu(
|
||||
) AS "tableLabel",
|
||||
ttc.column_name AS "columnName",
|
||||
COALESCE(
|
||||
cl.column_label,
|
||||
ttc.column_label,
|
||||
initcap(replace(ttc.column_name, '_', ' '))
|
||||
) AS "columnLabel",
|
||||
ttc.input_type AS "inputType"
|
||||
FROM table_type_columns ttc
|
||||
LEFT JOIN column_labels cl
|
||||
ON ttc.table_name = cl.table_name
|
||||
AND ttc.column_name = cl.column_name
|
||||
LEFT JOIN table_labels tl
|
||||
ON ttc.table_name = tl.table_name
|
||||
WHERE ttc.input_type = 'category'
|
||||
@@ -2228,7 +2216,7 @@ export async function multiTableSave(
|
||||
|
||||
/**
|
||||
* 두 테이블 간 엔티티 관계 조회
|
||||
* column_labels의 entity/category 타입 설정을 기반으로 두 테이블 간의 관계를 조회
|
||||
* table_type_columns의 entity/category 타입 설정을 기반으로 두 테이블 간의 관계를 조회
|
||||
*/
|
||||
export async function getTableEntityRelations(
|
||||
req: AuthenticatedRequest,
|
||||
@@ -2253,11 +2241,12 @@ export async function getTableEntityRelations(
|
||||
table_name,
|
||||
column_name,
|
||||
column_label,
|
||||
web_type,
|
||||
input_type as web_type,
|
||||
detail_settings
|
||||
FROM column_labels
|
||||
FROM table_type_columns
|
||||
WHERE table_name IN ($1, $2)
|
||||
AND web_type IN ('entity', 'category')
|
||||
AND input_type IN ('entity', 'category')
|
||||
AND company_code = '*'
|
||||
`;
|
||||
|
||||
const result = await query(columnLabelsQuery, [leftTable, rightTable]);
|
||||
@@ -2332,7 +2321,7 @@ export async function getTableEntityRelations(
|
||||
* 현재 테이블을 참조(FK로 연결)하는 테이블 목록 조회
|
||||
* GET /api/table-management/columns/:tableName/referenced-by
|
||||
*
|
||||
* column_labels에서 reference_table이 현재 테이블인 레코드를 찾아서
|
||||
* table_type_columns에서 reference_table이 현재 테이블인 레코드를 찾아서
|
||||
* 해당 테이블과 FK 컬럼 정보를 반환합니다.
|
||||
*/
|
||||
export async function getReferencedByTables(
|
||||
@@ -2359,21 +2348,22 @@ export async function getReferencedByTables(
|
||||
return;
|
||||
}
|
||||
|
||||
// column_labels에서 reference_table이 현재 테이블인 레코드 조회
|
||||
// table_type_columns에서 reference_table이 현재 테이블인 레코드 조회
|
||||
// input_type이 'entity'인 것만 조회 (실제 FK 관계)
|
||||
const sqlQuery = `
|
||||
SELECT DISTINCT
|
||||
cl.table_name,
|
||||
cl.column_name,
|
||||
cl.column_label,
|
||||
cl.reference_table,
|
||||
cl.reference_column,
|
||||
cl.display_column,
|
||||
cl.table_name as table_label
|
||||
FROM column_labels cl
|
||||
WHERE cl.reference_table = $1
|
||||
AND cl.input_type = 'entity'
|
||||
ORDER BY cl.table_name, cl.column_name
|
||||
ttc.table_name,
|
||||
ttc.column_name,
|
||||
ttc.column_label,
|
||||
ttc.reference_table,
|
||||
ttc.reference_column,
|
||||
ttc.display_column,
|
||||
ttc.table_name as table_label
|
||||
FROM table_type_columns ttc
|
||||
WHERE ttc.reference_table = $1
|
||||
AND ttc.input_type = 'entity'
|
||||
AND ttc.company_code = '*'
|
||||
ORDER BY ttc.table_name, ttc.column_name
|
||||
`;
|
||||
|
||||
const result = await query(sqlQuery, [tableName]);
|
||||
|
||||
Reference in New Issue
Block a user