공통코드 수정중
This commit is contained in:
@@ -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;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user