mirror of https://gitee.com/maxjhandsome/pig
Merge branch 'dev' of https://gitee.com/log4j/pig into dev
This commit is contained in:
commit
f37918d86a
|
@ -11,6 +11,9 @@
|
|||
### 详细配置 wiki
|
||||
https://gitee.com/log4j/pig/wikis/
|
||||
|
||||
### FQA、反馈
|
||||
https://gitee.com/log4j/pig/issues
|
||||
|
||||
### 视频教程
|
||||
|
||||
1. [课程介绍项目介绍](http://p3blpcsde.bkt.clouddn.com/1.mp4)
|
||||
|
@ -18,6 +21,9 @@
|
|||
3. [oAuth2认证授权及其源码详解](http://p3blpcsde.bkt.clouddn.com/3.mp4)
|
||||
|
||||
|
||||
### 默认账号:admin 密码:123456
|
||||
|
||||
|
||||
### now
|
||||
``` lua
|
||||
pig
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.pig.common.bean.interceptor;
|
|||
import com.baomidou.mybatisplus.plugins.SqlParserHandler;
|
||||
import com.baomidou.mybatisplus.toolkit.PluginUtils;
|
||||
import com.xiaoleilu.hutool.util.CollectionUtil;
|
||||
import com.xiaoleilu.hutool.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.executor.statement.StatementHandler;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
|
@ -49,9 +50,11 @@ public class DataScopeInterceptor extends SqlParserHandler implements Intercepto
|
|||
} else {
|
||||
String scopeName = dataScope.getScopeName();
|
||||
List<Integer> deptIds = dataScope.getDeptIds();
|
||||
String join = CollectionUtil.join(deptIds, ",");
|
||||
originalSql = "select * from (" + originalSql + ") temp_data_scope where temp_data_scope." + scopeName + " in (" + join + ")";
|
||||
metaObject.setValue("delegate.boundSql.sql", originalSql);
|
||||
if(StrUtil.isNotBlank(scopeName) && CollectionUtil.isNotEmpty(deptIds)){
|
||||
String join = CollectionUtil.join(deptIds, ",");
|
||||
originalSql = "select * from (" + originalSql + ") temp_data_scope where temp_data_scope." + scopeName + " in (" + join + ")";
|
||||
metaObject.setValue("delegate.boundSql.sql", originalSql);
|
||||
}
|
||||
return invocation.proceed();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue