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