Search in sources :

Example 1 with DataScopeInnerInterceptor

use of top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor in project lamp-job by zuihou.

the class ExtendExecutorMybatisAutoConfiguration method getPaginationBeforeInnerInterceptor.

/**
 * 数据权限插件
 *
 * @return 数据权限插件
 */
@Override
protected List<InnerInterceptor> getPaginationBeforeInnerInterceptor() {
    List<InnerInterceptor> list = new ArrayList<>();
    Boolean isDataScope = databaseProperties.getIsDataScope();
    if (isDataScope) {
        list.add(new DataScopeInnerInterceptor(userId -> SpringUtils.getBean(UserService.class).getDataScopeById(userId)));
    }
    return list;
}
Also used : Configuration(org.springframework.context.annotation.Configuration) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) DataScopeInnerInterceptor(top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor) UserService(top.tangyh.lamp.authority.service.auth.UserService) BaseMybatisConfiguration(top.tangyh.basic.database.datasource.BaseMybatisConfiguration) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) InnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor) SpringUtils(top.tangyh.basic.utils.SpringUtils) DatabaseProperties(top.tangyh.basic.database.properties.DatabaseProperties) ArrayList(java.util.ArrayList) DataScopeInnerInterceptor(top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor) UserService(top.tangyh.lamp.authority.service.auth.UserService) ArrayList(java.util.ArrayList) DataScopeInnerInterceptor(top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor) InnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor)

Example 2 with DataScopeInnerInterceptor

use of top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor in project lamp-job by zuihou.

the class BaseExecutorMybatisAutoConfiguration method getPaginationBeforeInnerInterceptor.

/**
 * 数据权限插件
 *
 * @return 数据权限插件
 */
@Override
protected List<InnerInterceptor> getPaginationBeforeInnerInterceptor() {
    List<InnerInterceptor> list = new ArrayList<>();
    Boolean isDataScope = databaseProperties.getIsDataScope();
    if (isDataScope) {
        list.add(new DataScopeInnerInterceptor(userId -> SpringUtils.getBean(UserService.class).getDataScopeById(userId)));
    }
    return list;
}
Also used : Configuration(org.springframework.context.annotation.Configuration) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) DataScopeInnerInterceptor(top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor) UserService(top.tangyh.lamp.authority.service.auth.UserService) BaseMybatisConfiguration(top.tangyh.basic.database.datasource.BaseMybatisConfiguration) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) InnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor) SpringUtils(top.tangyh.basic.utils.SpringUtils) DatabaseProperties(top.tangyh.basic.database.properties.DatabaseProperties) ArrayList(java.util.ArrayList) DataScopeInnerInterceptor(top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor) UserService(top.tangyh.lamp.authority.service.auth.UserService) ArrayList(java.util.ArrayList) DataScopeInnerInterceptor(top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor) InnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor)

Aggregations

InnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Slf4j (lombok.extern.slf4j.Slf4j)2 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)2 Configuration (org.springframework.context.annotation.Configuration)2 BaseMybatisConfiguration (top.tangyh.basic.database.datasource.BaseMybatisConfiguration)2 DataScopeInnerInterceptor (top.tangyh.basic.database.mybatis.auth.DataScopeInnerInterceptor)2 DatabaseProperties (top.tangyh.basic.database.properties.DatabaseProperties)2 SpringUtils (top.tangyh.basic.utils.SpringUtils)2 UserService (top.tangyh.lamp.authority.service.auth.UserService)2