|
|
|
|
@ -25,11 +25,19 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
*
|
|
|
|
|
* @author 芋道源码
|
|
|
|
|
*/
|
|
|
|
|
@AutoConfiguration(before = MybatisPlusAutoConfiguration.class) // 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志
|
|
|
|
|
@AutoConfiguration(before = MybatisPlusAutoConfiguration.class)
|
|
|
|
|
// 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志
|
|
|
|
|
@MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class,
|
|
|
|
|
lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试
|
|
|
|
|
public class YudaoMybatisAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
JsqlParserGlobal.setJsqlParseCache(new JdkSerialCaffeineJsqlParseCache(
|
|
|
|
|
(cache) -> cache.maximumSize(1024)
|
|
|
|
|
.expireAfterWrite(5, TimeUnit.SECONDS))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
|
|
|
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
|
|
|
|
@ -38,7 +46,7 @@ public class YudaoMybatisAutoConfiguration {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
public MetaObjectHandler defaultMetaObjectHandler(){
|
|
|
|
|
public MetaObjectHandler defaultMetaObjectHandler() {
|
|
|
|
|
return new DefaultDBFieldHandler(); // 自动填充参数类
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -65,10 +73,5 @@ public class YudaoMybatisAutoConfiguration {
|
|
|
|
|
throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
JsqlParserGlobal.setJsqlParseCache(new JdkSerialCaffeineJsqlParseCache(
|
|
|
|
|
(cache) -> cache.maximumSize(1024)
|
|
|
|
|
.expireAfterWrite(5, TimeUnit.SECONDS))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|