feat: add SQL Server support and refactor database layer for multi-database compatibility

- Add SqlServerService integration alongside existing MySQL support
- Refactor DAOs (DiscreteMaterialPlanDAO, MaterialsToBeDeletedDAO, BipUsersDAO) to support both MySQL and SQL Server
- Update validation handler to dynamically select database service based on DB_TYPE environment variable
- Add connection pooling and proper connection management for SQL Server
- Update package-lock.json dependency peer flags

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-03-02 11:10:59 +08:00
parent bbdd1e18f8
commit 05d856309f
6 changed files with 1207 additions and 473 deletions

View File

@@ -98,8 +98,9 @@ export class SqlServerService {
const result = await request.query(sqlString)
// Convert recordset to array of objects
const columns = result.recordset.columns?.map((col) => col.name) || []
const rows = result.recordset as Record<string, unknown>[]
// Extract column names from the first row if available
const columns = rows.length > 0 ? Object.keys(rows[0]) : []
return {
rows,
@@ -137,8 +138,9 @@ export class SqlServerService {
const result = await request.query(sqlString)
// Convert recordset to array of objects
const columns = result.recordset.columns?.map((col) => col.name) || []
const rows = result.recordset as Record<string, unknown>[]
// Extract column names from the first row if available
const columns = rows.length > 0 ? Object.keys(rows[0]) : []
return {
rows,