diff --git a/build-frontend.bat b/build-frontend.bat index 439033e0..ea01a144 100644 --- a/build-frontend.bat +++ b/build-frontend.bat @@ -3,8 +3,10 @@ setlocal set REPO=%~dp0 set WEBDIST=%REPO%web-dist -echo [1/4] build frontend (pnpm build) ... +echo [1/4] build frontend (pnpm install + build) ... cd /d %REPO%jeecgboot-vue3 +call pnpm install +if errorlevel 1 ( echo [ERROR] pnpm install failed & pause & exit /b 1 ) call pnpm run build if errorlevel 1 ( echo [ERROR] frontend build failed & pause & exit /b 1 ) if not exist "%REPO%jeecgboot-vue3\dist\index.html" ( echo [ERROR] dist/index.html not found & pause & exit /b 1 ) diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 index ae0c7f64..88ba16f6 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 @@ -1092,3 +1092,9 @@ jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRec jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecord.data.ts jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecordList.vue jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/components/MesXslEquipDowntimeRecordModal.vue + +-- author:GHT---date:20260616--for: 【MES上辅机】生产环境 SQL Server 中间库连接池校验 DUAL 报错修复 --- +原因:application-prod.yml 全局 druid.validationQuery 为 SELECT 1 FROM DUAL,动态创建的 sqlserver_mcs 数据源继承该配置后在 SQL Server 上报「对象名 DUAL 无效」。 +修改:prod 全局改为 SELECT 1;McsDataSourceManager 创建/恢复 SQL Server 数据源时显式设置 validationQuery=SELECT 1。 +jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml +jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/datasource/McsDataSourceManager.java diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/datasource/McsDataSourceManager.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/datasource/McsDataSourceManager.java index 99b1e3ec..d01bf1b4 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/datasource/McsDataSourceManager.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/datasource/McsDataSourceManager.java @@ -3,6 +3,7 @@ package org.jeecg.modules.xslmes.mcs.datasource; import com.alibaba.druid.pool.DruidDataSource; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.creator.DataSourceProperty; +import com.baomidou.dynamic.datasource.creator.druid.DruidConfig; import com.baomidou.dynamic.datasource.creator.druid.DruidDataSourceCreator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -171,9 +172,22 @@ public class McsDataSourceManager { property.setUrl(buildJdbcUrl(config)); property.setUsername(config.getDbUsername()); property.setPassword(plainPassword); + applySqlServerDruidConfig(property); return property; } + /** + * SQL Server 不支持 Oracle/MySQL 的 DUAL 表,覆盖全局 validationQuery 避免连接池校验失败 + */ + private void applySqlServerDruidConfig(DataSourceProperty property) { + DruidConfig druid = property.getDruid(); + if (druid == null) { + druid = new DruidConfig(); + property.setDruid(druid); + } + druid.setValidationQuery("SELECT 1"); + } + private void restoreYmlDataSource(DynamicRoutingDataSource routing) { if (StringUtils.isBlank(ymlUrl)) { log.warn("[MCS中间库] yml 中未配置 sqlserver_mcs,无法恢复默认数据源"); @@ -186,6 +200,7 @@ public class McsDataSourceManager { property.setUrl(ymlUrl); property.setUsername(ymlUsername); property.setPassword(ymlPassword); + applySqlServerDruidConfig(property); routing.addDataSource(DS_KEY, dataSourceCreator.createDataSource(property)); } catch (Exception e) { log.error("[MCS中间库] 恢复 yml 默认数据源失败", e); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml index 77174b48..887442c9 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml @@ -128,7 +128,8 @@ spring: timeBetweenEvictionRunsMillis: 60000 # 配置一个连接在池中最小生存的时间,单位是毫秒 minEvictableIdleTimeMillis: 300000 - validationQuery: SELECT 1 FROM DUAL + # SQL Server 中间库不支持 DUAL,使用通用校验语句(MySQL/SQL Server 均兼容) + validationQuery: SELECT 1 testWhileIdle: true testOnBorrow: false testOnReturn: false