공통코드 수정중

This commit is contained in:
kjs
2025-12-22 13:45:08 +09:00
parent ac526c8578
commit b01efd293c
9 changed files with 560 additions and 35 deletions

View File

@@ -3,6 +3,8 @@ import {
CodeCategory,
CodeInfo,
CodeOption,
CodeHierarchyNode,
CodeChildOption,
CreateCategoryRequest,
UpdateCategoryRequest,
CreateCodeRequest,
@@ -166,4 +168,34 @@ export const commonCodeApi = {
return response.data;
},
},
// 계층 구조 API
hierarchy: {
/**
* 계층 구조 코드 조회 (트리 형태)
*/
async getTree(categoryCode: string): Promise<ApiResponse<CodeHierarchyNode[]>> {
const response = await apiClient.get(`/common-codes/categories/${categoryCode}/hierarchy`);
return response.data;
},
/**
* 자식 코드 조회 (연쇄 선택용)
* @param categoryCode 카테고리 코드
* @param parentCodeValue 부모 코드 값 (null이면 최상위)
*/
async getChildren(
categoryCode: string,
parentCodeValue?: string | null
): Promise<ApiResponse<CodeChildOption[]>> {
const params = new URLSearchParams();
if (parentCodeValue) {
params.append("parentCodeValue", parentCodeValue);
}
const queryString = params.toString();
const url = `/common-codes/categories/${categoryCode}/children${queryString ? `?${queryString}` : ""}`;
const response = await apiClient.get(url);
return response.data;
},
},
};