|  |  | @ -1,5 +1,9 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package com.glxp.sale.admin.config; |  |  |  | package com.glxp.sale.admin.config; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.MybatisConfiguration; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.config.GlobalConfig; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; |  |  |  | import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.apache.ibatis.session.SqlSessionFactory; |  |  |  | import org.apache.ibatis.session.SqlSessionFactory; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.mybatis.spring.SqlSessionFactoryBean; |  |  |  | import org.mybatis.spring.SqlSessionFactoryBean; | 
			
		
	
	
		
		
			
				
					|  |  | @ -36,14 +40,36 @@ public class MasterDataSourceConfig {//TODO Mapper | 
			
		
	
		
		
			
				
					
					|  |  |  |         return new DataSourceTransactionManager(masterDataSource()); |  |  |  |         return new DataSourceTransactionManager(masterDataSource()); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Configuration | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @ConfigurationProperties(prefix = "mybatis-plus.configuration") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public class CusMybatisConfiguration extends MybatisConfiguration{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Configuration | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @ConfigurationProperties(prefix = "mybatis-plus.global-config") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public class CusGlobalConfig extends GlobalConfig { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Bean(name = "masterSqlSessionFactory") |  |  |  |     @Bean(name = "masterSqlSessionFactory") | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Primary |  |  |  |     @Primary | 
			
		
	
		
		
			
				
					
					|  |  |  |     public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource) |  |  |  |     public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource, CusMybatisConfiguration configuration, CusGlobalConfig globalConfig) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             throws Exception { |  |  |  |             throws Exception { | 
			
		
	
		
		
			
				
					
					|  |  |  |         final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean(); |  |  |  |         final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         sessionFactory.setDataSource(masterDataSource); |  |  |  |         sessionFactory.setDataSource(masterDataSource); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sessionFactory.setConfiguration((MybatisConfiguration) configuration); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sessionFactory.setGlobalConfig(globalConfig); | 
			
		
	
		
		
			
				
					
					|  |  |  |         sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() |  |  |  |         sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() | 
			
		
	
		
		
			
				
					
					|  |  |  |                 .getResources(MasterDataSourceConfig.MAPPER_LOCATION)); |  |  |  |                 .getResources(MasterDataSourceConfig.MAPPER_LOCATION)); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return sessionFactory.getObject(); |  |  |  |         return sessionFactory.getObject(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 防全表更新与删除插件 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Bean | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public MybatisPlusInterceptor mybatisPlusInterceptor() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return interceptor; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |