| | |
| | | import com.google.gson.Gson; |
| | | import com.ltkj.db.DataSourceConfig; |
| | | import com.ltkj.db.DataSourceContextHolder; |
| | | import com.ltkj.framework.config.DruidConfig; |
| | | import com.ltkj.hosp.domain.DictHosp; |
| | | import com.ltkj.hosp.service.IDictHospService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @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; |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { |
| | |
| | | return false; |
| | | } |
| | | dataSourceConfig.addDataSource(hosp.getDbname()); |
| | | // druidConfig.addDataSource(hosp.getDbname()); |
| | | DataSourceContextHolder.setDataSourceKey(hosp.getDbname()); |
| | | } catch (IOException e) { |
| | | return false; |