2348800e68
Build & Deploy to K8s / build-and-deploy (push) Successful in 9m22s
카테고리/캐스케이딩 시스템 (B/C/D) 전부 폐기:
- BE: mapper/Service/Controller 9세트 삭제 (cascading*, categoryTree, tableCategoryValue, categoryValueCascading, codeMerge)
- FE: 페이지 3 + API 8 + hooks 2 + 폐기 컴포넌트 6 삭제, 14곳 의존성 정리
- DB: 12 테이블 DROP, TABLE_TYPE_COLUMNS.CODE_CATEGORY → CODE_INFO rename
신설 commonCode 마스터-디테일:
- code_info: 1레벨 그룹 마스터
- code_detail: 2~∞ depth 재귀 트리 (parent_detail_id self-FK, depth 자동 계산)
- API: /api/common-codes/{info,detail}
- CodeCategoryFormModal/Panel → CodeInfoFormModal/Panel rename
- code_category 컬럼명 전부 code_info 로 치환 (mapper/Java/FE)
- 옛 commonCode API URL (/categories/...) → getCodeOptions 어댑터 + /detail?code_info=... 전환
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
94 lines
2.7 KiB
TypeScript
94 lines
2.7 KiB
TypeScript
import { apiClient } from "./client";
|
|
|
|
export interface EntityReferenceOption {
|
|
value: string;
|
|
label: string;
|
|
}
|
|
|
|
export interface EntityReferenceData {
|
|
options: EntityReferenceOption[];
|
|
referenceInfo: {
|
|
referenceTable: string;
|
|
referenceColumn: string;
|
|
displayColumn: string | null;
|
|
};
|
|
}
|
|
|
|
export interface CodeReferenceData {
|
|
options: EntityReferenceOption[];
|
|
codeInfo: string;
|
|
}
|
|
|
|
export interface ApiResponse<T> {
|
|
success: boolean;
|
|
message: string;
|
|
data?: T;
|
|
error?: string;
|
|
}
|
|
|
|
export class EntityReferenceAPI {
|
|
/**
|
|
* 엔티티 참조 데이터 조회
|
|
*/
|
|
static async getEntityReferenceData(
|
|
tableName: string,
|
|
columnName: string,
|
|
options: {
|
|
limit?: number;
|
|
search?: string;
|
|
} = {},
|
|
): Promise<EntityReferenceData> {
|
|
try {
|
|
const params = new URLSearchParams();
|
|
if (options.limit) params.append("limit", options.limit.toString());
|
|
if (options.search) params.append("search", options.search);
|
|
|
|
const queryString = params.toString();
|
|
const url = `/entity-reference/${tableName}/${columnName}${queryString ? `?${queryString}` : ""}`;
|
|
|
|
const response = await apiClient.get<ApiResponse<EntityReferenceData>>(url);
|
|
|
|
if (!response.data.success || !response.data.data) {
|
|
throw new Error(response.data.message || "엔티티 참조 데이터 조회에 실패했습니다.");
|
|
}
|
|
|
|
return response.data.data;
|
|
} catch (error) {
|
|
console.error("엔티티 참조 데이터 조회 오류:", error);
|
|
throw error instanceof Error ? error : new Error("엔티티 참조 데이터 조회 중 오류가 발생했습니다.");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 공통 코드 데이터 조회
|
|
*/
|
|
static async getCodeReferenceData(
|
|
codeInfo: string,
|
|
options: {
|
|
limit?: number;
|
|
search?: string;
|
|
} = {},
|
|
): Promise<CodeReferenceData> {
|
|
try {
|
|
const params = new URLSearchParams();
|
|
if (options.limit) params.append("limit", options.limit.toString());
|
|
if (options.search) params.append("search", options.search);
|
|
|
|
const queryString = params.toString();
|
|
const url = `/entity-reference/code/${codeInfo}${queryString ? `?${queryString}` : ""}`;
|
|
|
|
const response = await apiClient.get<ApiResponse<CodeReferenceData>>(url);
|
|
|
|
if (!response.data.success || !response.data.data) {
|
|
throw new Error(response.data.message || "공통 코드 데이터 조회에 실패했습니다.");
|
|
}
|
|
|
|
return response.data.data;
|
|
} catch (error) {
|
|
console.error("공통 코드 데이터 조회 오류:", error);
|
|
throw error instanceof Error ? error : new Error("공통 코드 데이터 조회 중 오류가 발생했습니다.");
|
|
}
|
|
}
|
|
}
|
|
|