다국어 키 자동생성 로직

This commit is contained in:
kjs
2026-01-14 11:05:57 +09:00
parent 61a7f585b4
commit 24315215de
5 changed files with 123 additions and 33 deletions

View File

@@ -190,7 +190,7 @@ export const getLangKeys = async (
res: Response
): Promise<void> => {
try {
const { companyCode, menuCode, keyType, searchText } = req.query;
const { companyCode, menuCode, keyType, searchText, categoryId } = req.query;
logger.info("다국어 키 목록 조회 요청", {
query: req.query,
user: req.user,
@@ -202,6 +202,7 @@ export const getLangKeys = async (
menuCode: menuCode as string,
keyType: keyType as string,
searchText: searchText as string,
categoryId: categoryId ? parseInt(categoryId as string, 10) : undefined,
});
const response: ApiResponse<any[]> = {

View File

@@ -696,6 +696,21 @@ export class MultiLangService {
values.push(params.menuCode);
}
// 카테고리 필터 (하위 카테고리 포함)
if (params.categoryId) {
whereConditions.push(`category_id IN (
WITH RECURSIVE category_tree AS (
SELECT category_id FROM multi_lang_category WHERE category_id = $${paramIndex}
UNION ALL
SELECT c.category_id FROM multi_lang_category c
INNER JOIN category_tree ct ON c.parent_id = ct.category_id
)
SELECT category_id FROM category_tree
)`);
values.push(params.categoryId);
paramIndex++;
}
// 검색 조건 (OR)
if (params.searchText) {
whereConditions.push(
@@ -717,12 +732,13 @@ export class MultiLangService {
lang_key: string;
description: string | null;
is_active: string | null;
category_id: number | null;
created_date: Date | null;
created_by: string | null;
updated_date: Date | null;
updated_by: string | null;
}>(
`SELECT key_id, company_code, usage_note, lang_key, description, is_active,
`SELECT key_id, company_code, usage_note, lang_key, description, is_active, category_id,
created_date, created_by, updated_date, updated_by
FROM multi_lang_key_master
${whereClause}
@@ -737,6 +753,7 @@ export class MultiLangService {
langKey: key.lang_key,
description: key.description || undefined,
isActive: key.is_active || "Y",
categoryId: key.category_id || undefined,
createdDate: key.created_date || undefined,
createdBy: key.created_by || undefined,
updatedDate: key.updated_date || undefined,