zhaowenxuan
2025-02-15 d9006551fff47c172ea6a0672af7dd21df34f28f
ltkj-framework/src/main/java/com/ltkj/framework/interceptor/DBChangeInterceptor.java
@@ -24,15 +24,15 @@
 * @Date: 2025/2/7 11:07
 */
@Component
@Order(2)
@Order(1)
public class DBChangeInterceptor implements HandlerInterceptor {
    @Autowired
    private IDictHospService dictHospService;
//    @Autowired
//    private DataSourceConfig dataSourceConfig;
    @Autowired
    private DruidConfig druidConfig;
    private DataSourceConfig dataSourceConfig;
//    @Autowired
//    private DruidConfig druidConfig;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
@@ -55,8 +55,8 @@
                response.getWriter().write("{\"message\":\"401:找不到院区数据\"}");
                return false;
            }
//            dataSourceConfig.addDataSource(hosp.getDbname());
            druidConfig.addDataSource(hosp.getDbname());
            dataSourceConfig.addDataSource(hosp.getDbname());
//            druidConfig.addDataSource(hosp.getDbname());
            DataSourceContextHolder.setDataSourceKey(hosp.getDbname());
        } catch (IOException e) {
            return false;