权限
This commit is contained in:
parent
988880265c
commit
cdb12bc9e0
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.mybatis;
|
package com.zhgd.mybatis;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -31,10 +32,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DataScopeInterceptor extends JsqlParserSupport implements InnerInterceptor {
|
public class DataScopeInterceptor extends JsqlParserSupport implements InnerInterceptor {
|
||||||
@ -170,6 +168,14 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
|||||||
} else {
|
} else {
|
||||||
processFromItem(fromItem, obj);
|
processFromItem(fromItem, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果还存在关联查询
|
||||||
|
List<Join> joins = plainSelect.getJoins();
|
||||||
|
if (CollUtil.isNotEmpty(joins)) {
|
||||||
|
for (Join join : joins) {
|
||||||
|
processJoin(join, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processFromItem(FromItem fromItem, Object obj) {
|
protected void processFromItem(FromItem fromItem, Object obj) {
|
||||||
@ -180,4 +186,18 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理关联查询
|
||||||
|
*
|
||||||
|
* @param join 关联查询
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
protected void processJoin(Join join, Object obj) {
|
||||||
|
FromItem joinTable = join.getRightItem();
|
||||||
|
if (joinTable instanceof SubSelect) {
|
||||||
|
processSelectBody(((SubSelect) joinTable).getSelectBody(), obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user