테이블 데이터 필터링 기능 및 textarea컴포넌트 자동 매핑 삭제
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* - 최고 관리자(company_code = "*")만 전체 데이터 조회 가능
|
||||
*/
|
||||
import { query, queryOne } from "../database/db";
|
||||
import { buildDataFilterWhereClause } from "../utils/dataFilterUtil"; // 🆕 데이터 필터 유틸
|
||||
|
||||
interface GetTableDataParams {
|
||||
tableName: string;
|
||||
@@ -434,7 +435,8 @@ class DataService {
|
||||
leftColumn: string,
|
||||
rightColumn: string,
|
||||
leftValue?: string | number,
|
||||
userCompany?: string
|
||||
userCompany?: string,
|
||||
dataFilter?: any // 🆕 데이터 필터
|
||||
): Promise<ServiceResponse<any[]>> {
|
||||
try {
|
||||
// 왼쪽 테이블 접근 검증
|
||||
@@ -478,6 +480,17 @@ class DataService {
|
||||
}
|
||||
}
|
||||
|
||||
// 🆕 데이터 필터 적용 (우측 패널에 대해, 테이블 별칭 "r" 사용)
|
||||
if (dataFilter && dataFilter.enabled && dataFilter.filters && dataFilter.filters.length > 0) {
|
||||
const filterResult = buildDataFilterWhereClause(dataFilter, "r", paramIndex);
|
||||
if (filterResult.whereClause) {
|
||||
whereConditions.push(filterResult.whereClause);
|
||||
values.push(...filterResult.params);
|
||||
paramIndex += filterResult.params.length;
|
||||
console.log(`🔍 데이터 필터 적용 (${rightTable}):`, filterResult.whereClause);
|
||||
}
|
||||
}
|
||||
|
||||
// WHERE 절 추가
|
||||
if (whereConditions.length > 0) {
|
||||
queryText += ` WHERE ${whereConditions.join(" AND ")}`;
|
||||
|
||||
Reference in New Issue
Block a user