fix: 배치 관리 시스템 Oracle/MariaDB 커넥터 추가 및 timestamp 타입 변환 오류 수정
- DatabaseConnectorFactory에 Oracle, MariaDB 커넥터 추가 - BatchService에서 PostgreSQL timestamp 타입 캐스팅 추가 - BatchExternalDbService에 쿼리 로깅 추가 - 배치 실행 로그 관련 타입 및 컨트롤러 개선 - 프론트엔드 배치 관리 UI 개선
This commit is contained in:
parent
949aab0b73
commit
5921a84581
|
|
@ -176,3 +176,4 @@ export class BatchExecutionLogController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { DatabaseConnector, ConnectionConfig } from '../interfaces/DatabaseConnector';
|
||||
import { PostgreSQLConnector } from './PostgreSQLConnector';
|
||||
import { OracleConnector } from './OracleConnector';
|
||||
import { MariaDBConnector } from './MariaDBConnector';
|
||||
|
||||
export class DatabaseConnectorFactory {
|
||||
private static connectors = new Map<string, DatabaseConnector>();
|
||||
|
|
@ -20,6 +22,12 @@ export class DatabaseConnectorFactory {
|
|||
case 'postgresql':
|
||||
connector = new PostgreSQLConnector(config);
|
||||
break;
|
||||
case 'oracle':
|
||||
connector = new OracleConnector(config);
|
||||
break;
|
||||
case 'mariadb':
|
||||
connector = new MariaDBConnector(config);
|
||||
break;
|
||||
// Add other database types here
|
||||
default:
|
||||
throw new Error(`지원하지 않는 데이터베이스 타입: ${type}`);
|
||||
|
|
|
|||
|
|
@ -44,3 +44,4 @@ router.get("/latest/:batchConfigId", authenticateToken, BatchExecutionLogControl
|
|||
router.get("/stats", authenticateToken, BatchExecutionLogController.getExecutionStats);
|
||||
|
||||
export default router;
|
||||
|
||||
|
|
|
|||
|
|
@ -660,6 +660,9 @@ export class BatchExternalDbService {
|
|||
query = `INSERT INTO ${tableName} (${columns.join(', ')}) VALUES (${formattedValues})`;
|
||||
}
|
||||
|
||||
console.log(`[BatchExternalDbService] 실행할 쿼리: ${query}`);
|
||||
console.log(`[BatchExternalDbService] 삽입할 데이터:`, record);
|
||||
|
||||
await connector.executeQuery(query);
|
||||
successCount++;
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -368,3 +368,4 @@ export class BatchManagementService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -667,10 +667,27 @@ export class BatchService {
|
|||
if (dateRegex.test(value)) {
|
||||
return new Date(value).toISOString();
|
||||
}
|
||||
// ISO 날짜 문자열 형식 체크 (2025-09-24T06:29:01.351Z)
|
||||
const isoDateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/;
|
||||
if (isoDateRegex.test(value)) {
|
||||
return new Date(value).toISOString();
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
const placeholders = values.map((_, index) => `$${index + 1}`).join(', ');
|
||||
|
||||
// PostgreSQL 타입 캐스팅을 위한 placeholder 생성
|
||||
const placeholders = columns.map((col, index) => {
|
||||
// 날짜/시간 관련 컬럼명 패턴 체크
|
||||
if (col.toLowerCase().includes('date') ||
|
||||
col.toLowerCase().includes('time') ||
|
||||
col.toLowerCase().includes('created') ||
|
||||
col.toLowerCase().includes('updated') ||
|
||||
col.toLowerCase().includes('reg')) {
|
||||
return `$${index + 1}::timestamp`;
|
||||
}
|
||||
return `$${index + 1}`;
|
||||
}).join(', ');
|
||||
|
||||
// Primary Key 컬럼 추정 (일반적으로 id 또는 첫 번째 컬럼)
|
||||
const primaryKeyColumn = columns.includes('id') ? 'id' :
|
||||
|
|
|
|||
|
|
@ -61,3 +61,4 @@ export interface BatchExecutionLogWithConfig extends BatchExecutionLog {
|
|||
is_active?: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,3 +15,4 @@ declare module 'oracledb' {
|
|||
export function getPool(): any;
|
||||
export function close(): Promise<void>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -505,3 +505,4 @@ export default function BatchManagementNewPage() {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,3 +111,4 @@ export const BatchManagementAPI = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue