mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
调整Mybaits Plus Join的SQL注入器到YudaoMybatisAutoConfiguration
This commit is contained in:
parent
ef510f9478
commit
7e0fb6cb56
@ -1,19 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.mybatis.config;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
|
||||||
import icu.mhb.mybatisplus.plugln.injector.JoinDefaultSqlInjector;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
// TODO @升平:是不是作为 YudaoMybatisAutoConfiguration 的 bean 即可呀?然后 getMethodList 不用重写
|
|
||||||
@Configuration
|
|
||||||
public class MybatisPlusJoinConfiguration extends JoinDefaultSqlInjector {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
|
|
||||||
return super.getMethodList(mapperClass, tableInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,12 +5,14 @@ import cn.iocoder.yudao.framework.mybatis.core.handler.DefaultDBFieldHandler;
|
|||||||
import com.baomidou.mybatisplus.annotation.DbType;
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator;
|
import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator;
|
||||||
|
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
|
||||||
import com.baomidou.mybatisplus.extension.incrementer.H2KeyGenerator;
|
import com.baomidou.mybatisplus.extension.incrementer.H2KeyGenerator;
|
||||||
import com.baomidou.mybatisplus.extension.incrementer.KingbaseKeyGenerator;
|
import com.baomidou.mybatisplus.extension.incrementer.KingbaseKeyGenerator;
|
||||||
import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
|
import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
|
||||||
import com.baomidou.mybatisplus.extension.incrementer.PostgreKeyGenerator;
|
import com.baomidou.mybatisplus.extension.incrementer.PostgreKeyGenerator;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import icu.mhb.mybatisplus.plugln.injector.JoinDefaultSqlInjector;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
@ -40,6 +42,11 @@ public class YudaoMybatisAutoConfiguration {
|
|||||||
return new DefaultDBFieldHandler(); // 自动填充参数类
|
return new DefaultDBFieldHandler(); // 自动填充参数类
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DefaultSqlInjector defaultSqlInjector() {
|
||||||
|
return new JoinDefaultSqlInjector(); // 使用Mybaits Plus Join定义的SQL注入器
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "mybatis-plus.global-config.db-config", name = "id-type", havingValue = "INPUT")
|
@ConditionalOnProperty(prefix = "mybatis-plus.global-config.db-config", name = "id-type", havingValue = "INPUT")
|
||||||
public IKeyGenerator keyGenerator(ConfigurableEnvironment environment) {
|
public IKeyGenerator keyGenerator(ConfigurableEnvironment environment) {
|
||||||
|
Loading…
Reference in New Issue
Block a user