feat: Add menu icon support in menu management

- Enhanced the menu management functionality by adding a new `menu_icon` field in the database schema, allowing for the storage of menu icons.
- Updated the `saveMenu` and `updateMenu` functions in the admin controller to handle the new `menu_icon` field during menu creation and updates.
- Modified the `AdminService` to include `MENU_ICON` in various queries, ensuring that the icon data is retrieved and processed correctly.
- Integrated the `MenuIconPicker` component in the frontend to allow users to select and display menu icons in the `MenuFormModal`.
- Updated the sidebar and layout components to utilize the new icon data, enhancing the visual representation of menus across the application.
This commit is contained in:
kjs
2026-03-03 15:42:30 +09:00
parent f697e1e897
commit ce8b4ed688
9 changed files with 620 additions and 25 deletions

View File

@@ -1120,8 +1120,8 @@ export async function saveMenu(
`INSERT INTO menu_info (
objid, menu_type, parent_obj_id, menu_name_kor, menu_name_eng,
seq, menu_url, menu_desc, writer, regdate, status,
system_name, company_code, lang_key, lang_key_desc, screen_code
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
system_name, company_code, lang_key, lang_key_desc, screen_code, menu_icon
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
RETURNING *`,
[
objid,
@@ -1140,6 +1140,7 @@ export async function saveMenu(
menuData.langKey || null,
menuData.langKeyDesc || null,
screenCode,
menuData.menuIcon || null,
]
);
@@ -1323,8 +1324,9 @@ export async function updateMenu(
company_code = $10,
lang_key = $11,
lang_key_desc = $12,
screen_code = $13
WHERE objid = $14
screen_code = $13,
menu_icon = $14
WHERE objid = $15
RETURNING *`,
[
menuData.menuType ? Number(menuData.menuType) : null,
@@ -1340,6 +1342,7 @@ export async function updateMenu(
menuData.langKey || null,
menuData.langKeyDesc || null,
screenCode,
menuData.menuIcon || null,
Number(menuId),
]
);

View File

@@ -227,7 +227,8 @@ export class AdminService {
PATH,
CYCLE,
TRANSLATED_NAME,
TRANSLATED_DESC
TRANSLATED_DESC,
MENU_ICON
) AS (
SELECT
1 AS LEVEL,
@@ -282,7 +283,8 @@ export class AdminService {
AND MLT.lang_code = $1
LIMIT 1),
MENU.MENU_DESC
)
),
MENU.MENU_ICON
FROM MENU_INFO MENU
WHERE ${menuTypeCondition}
AND ${statusCondition}
@@ -348,7 +350,8 @@ export class AdminService {
AND MLT.lang_code = $1
LIMIT 1),
MENU_SUB.MENU_DESC
)
),
MENU_SUB.MENU_ICON
FROM MENU_INFO MENU_SUB
JOIN V_MENU ON MENU_SUB.PARENT_OBJ_ID = V_MENU.OBJID
WHERE MENU_SUB.OBJID != ANY(V_MENU.PATH)
@@ -374,6 +377,7 @@ export class AdminService {
COALESCE(CM.COMPANY_NAME, '미지정') AS COMPANY_NAME,
A.TRANSLATED_NAME,
A.TRANSLATED_DESC,
A.MENU_ICON,
CASE UPPER(A.STATUS)
WHEN 'ACTIVE' THEN '활성화'
WHEN 'INACTIVE' THEN '비활성화'
@@ -514,7 +518,8 @@ export class AdminService {
LANG_KEY,
LANG_KEY_DESC,
PATH,
CYCLE
CYCLE,
MENU_ICON
) AS (
SELECT
1 AS LEVEL,
@@ -532,7 +537,8 @@ export class AdminService {
LANG_KEY,
LANG_KEY_DESC,
ARRAY [MENU.OBJID],
FALSE
FALSE,
MENU.MENU_ICON
FROM MENU_INFO MENU
WHERE PARENT_OBJ_ID = 0
AND MENU_TYPE = 1
@@ -558,7 +564,8 @@ export class AdminService {
MENU_SUB.LANG_KEY,
MENU_SUB.LANG_KEY_DESC,
PATH || MENU_SUB.SEQ::numeric,
MENU_SUB.OBJID = ANY(PATH)
MENU_SUB.OBJID = ANY(PATH),
MENU_SUB.MENU_ICON
FROM MENU_INFO MENU_SUB
JOIN V_MENU ON MENU_SUB.PARENT_OBJ_ID = V_MENU.OBJID
WHERE MENU_SUB.STATUS = 'active'
@@ -584,10 +591,9 @@ export class AdminService {
A.COMPANY_CODE,
A.LANG_KEY,
A.LANG_KEY_DESC,
A.MENU_ICON,
COALESCE(CM.COMPANY_NAME, '미지정') AS COMPANY_NAME,
-- 번역된 메뉴명 (우선순위: 번역 > 기본명)
COALESCE(MLT_NAME.lang_text, A.MENU_NAME_KOR) AS TRANSLATED_NAME,
-- 번역된 설명 (우선순위: 번역 > 기본명)
COALESCE(MLT_DESC.lang_text, A.MENU_DESC) AS TRANSLATED_DESC,
CASE UPPER(A.STATUS)
WHEN 'ACTIVE' THEN '활성화'