@@ -32,12 +32,12 @@ public class MyDataPermissionHandler implements DataPermissionHandler {
|
|||||||
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringPool.DOT) + 1);
|
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringPool.DOT) + 1);
|
||||||
Method[] methods = clazz.getDeclaredMethods();
|
Method[] methods = clazz.getDeclaredMethods();
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
|
if (method.getName().equals(methodName)) {
|
||||||
DataPermission annotation = method.getAnnotation(DataPermission.class);
|
DataPermission annotation = method.getAnnotation(DataPermission.class);
|
||||||
// 如果没有注解或者是超级管理员,直接返回
|
// 如果没有注解或者是超级管理员,直接返回
|
||||||
if (annotation == null || SecurityUtils.isRoot() ) {
|
if (annotation == null || SecurityUtils.isRoot() ) {
|
||||||
return where;
|
return where;
|
||||||
}
|
}
|
||||||
if (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName)) {
|
|
||||||
return dataScopeFilter(annotation.deptAlias(), annotation.deptIdColumnName(), annotation.userAlias(), annotation.userIdColumnName(), where);
|
return dataScopeFilter(annotation.deptAlias(), annotation.deptIdColumnName(), annotation.userAlias(), annotation.userIdColumnName(), where);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user