"use client"; /** * 참조 테이블 조회 노드 (내부 DB 전용) * 다른 테이블에서 데이터를 조회하여 조건 비교나 필드 매핑에 사용 */ import { memo } from "react"; import { Handle, Position, NodeProps } from "reactflow"; import { Link2, Database } from "lucide-react"; import type { ReferenceLookupNodeData } from "@/types/node-editor"; export const ReferenceLookupNode = memo(({ data, selected }: NodeProps) => { return (
{/* 헤더 */}
{data.displayName || "참조 조회"}
{/* 본문 */}
내부 DB 참조
{/* 참조 테이블 */} {data.referenceTable && (
📋 참조 테이블
{data.referenceTableLabel || data.referenceTable}
)} {/* 조인 조건 */} {data.joinConditions && data.joinConditions.length > 0 && (
🔗 조인 조건:
{data.joinConditions.map((join, idx) => (
{join.sourceFieldLabel || join.sourceField} {join.referenceFieldLabel || join.referenceField}
))}
)} {/* WHERE 조건 */} {data.whereConditions && data.whereConditions.length > 0 && (
⚡ WHERE 조건:
{data.whereConditions.length}개 조건
)} {/* 출력 필드 */} {data.outputFields && data.outputFields.length > 0 && (
📤 출력 필드:
{data.outputFields.slice(0, 3).map((field, idx) => (
{field.alias} ← {field.fieldLabel || field.fieldName}
))} {data.outputFields.length > 3 && (
... 외 {data.outputFields.length - 3}개
)}
)}
{/* 입력 핸들 (왼쪽) */} {/* 출력 핸들 (오른쪽) */}
); }); ReferenceLookupNode.displayName = "ReferenceLookupNode";