#
luxiaotao1123
2023-12-19 b3b4ee7c60259878a0a7df7c0ebfd2954da48d91
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.zy.asrs.common.config;
 
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
/**
 * MybatisPlus配置
 *
 * @author vincent
 * @since 2018-02-22 11:29:28
 */
@Configuration
public class MybatisPlusConfig {
 
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
 
//        // 多租户插件配置
//        TenantLineHandler tenantLineHandler = new TenantLineHandler() {
//            @Override
//            public Expression getTenantId() {
//                return getLoginUserTenantId();
//            }
//
//            @Override
//            public boolean ignoreTable(String tableName) {
//                return Arrays.asList(
//                        "sys_tenant",
//                        "sys_dictionary",
//                        "sys_dictionary_data"
//                ).contains(tableName);
//            }
//        };
//        TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor(tenantLineHandler);
//        interceptor.addInnerInterceptor(tenantLineInnerInterceptor);
 
        // 分页插件配置
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
 
        return interceptor;
    }
 
}