| | |
| | | package com.vincent.rsf.server.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; |
| | | import com.baomidou.mybatisplus.core.MybatisConfiguration; |
| | | import com.baomidou.mybatisplus.extension.MybatisMapWrapperFactory; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | |
| | | * @since 2018-02-22 11:29:28 |
| | | */ |
| | | @Configuration |
| | | @EnableTransactionManagement |
| | | public class MybatisPlusConfig { |
| | | |
| | | @Bean |
| | |
| | | "sys_host", |
| | | "sys_user_role", |
| | | "sys_role_menu", |
| | | "sys_config" |
| | | "sys_menu", |
| | | "man_loc_type_rela" |
| | | ).contains(tableName); |
| | | } |
| | | }; |
| | | TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor(tenantLineHandler); |
| | | // interceptor.addInnerInterceptor(tenantLineInnerInterceptor); |
| | | interceptor.addInnerInterceptor(tenantLineInnerInterceptor); |
| | | |
| | | // 分页插件配置 |
| | | PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); |
| | |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | return new NullValue(); |
| | | //TODO 需设置一个系统调度帐号 |
| | | // return new NullValue(); |
| | | return new LongValue(1); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 解决Map映射非驼峰 |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public ConfigurationCustomizer mybatisConfigurationCustomizer(){ |
| | | return new ConfigurationCustomizer() { |
| | | /** |
| | | * Customize the given a {@link MybatisConfiguration} object. |
| | | * |
| | | * @param configuration the configuration object to customize |
| | | */ |
| | | @Override |
| | | public void customize(MybatisConfiguration configuration) { |
| | | configuration.setObjectWrapperFactory(new MybatisMapWrapperFactory()); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |