Commit ba515f01 authored by tianbo's avatar tianbo

修改数据权限传空字符导致平台sql报错问题

parent 7cd9874a
......@@ -71,8 +71,8 @@ public class PermissionInterceptor implements Interceptor {
// 被拦截方法
Method method = getTargetDataAuthMethod(mappedStatement);
DataAuth dataAuth = getTargetDataAuthAnnotation(mappedStatement);
// 没有DataAuth定义注解的跳过及没有手动指定使用数据规则的跳过
if (null == dataAuth && ValidationUtil.isEmpty(dataAuthRule)) {
// 没有DataAuth定义注解或注解为空的跳过及没有手动指定使用数据规则的跳过
if ((null == dataAuth || ValidationUtil.isEmpty(dataAuth.interfacePath())) && ValidationUtil.isEmpty(dataAuthRule)) {
PermissionInterceptorContext.clean();
return invocation.proceed();
}
......@@ -94,11 +94,11 @@ public class PermissionInterceptor implements Interceptor {
try {
sql = processSelectSql(sql, dataAuthorization, reginParam, boundSql);
} catch (Exception e) {
PermissionInterceptorContext.clean();
PermissionInterceptorContext.clean(dataAuthRule);
logger.debug(e.getMessage());
}
metaObject.setValue("delegate.boundSql.sql", sql);
PermissionInterceptorContext.clean();
PermissionInterceptorContext.clean(dataAuthRule);
return invocation.proceed();
}
......
......@@ -22,9 +22,17 @@ public class PermissionInterceptorContext {
public static void clean() {
if (requestContext != null) {
logger.info("clean RestThreadLocal......Begin");
logger.info("PermissionInterceptorContext clean RestThreadLocal......Begin");
requestContext.remove();
logger.info("clean RestThreadLocal......Done");
logger.info("PermissionInterceptorContext clean RestThreadLocal......Done");
}
}
public static void clean(String info) {
if (requestContext != null) {
logger.info("......" + info + "......PermissionInterceptorContext clean RestThreadLocal......Begin");
requestContext.remove();
logger.info("......" + info + "......PermissionInterceptorContext clean RestThreadLocal......Done");
}
}
}
......@@ -104,14 +104,12 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
OrgUsr queryByUserId(@Param("userId")Long userId);
@DataAuth(interfacePath = "")
List<OrgUsr> companyTreeByUserAndType(Map<String, Object> param);
List<OrgUsr> equipCompanyExport(String bizOrgCode);
OrgUsr queryBySequenceNbr(@Param("parentId") String parentId);
@DataAuth(interfacePath="")
List<OrgUsr> companyDeptListWithPersonCount(Map<String, Object> param);
List<OrgUsr> companyTreeByUser(String bizOrgCode);
......
......@@ -492,7 +492,8 @@ public class DataSourcesImpl implements DataSources {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// 权限处理
PermissionInterceptorContext.setDataAuthRule("key_site_info");
List<OrgMenuDto> orgUsrTree = iOrgUsrService.companyTreeByUserAndType(reginParams, OrgPersonEnum.公司.getKey());
// 修改bug6829 查询单位和部门数据
List<OrgMenuDto> orgUsrTree = iOrgUsrService.companyTreeByUserAndType(reginParams, null);
// List<OrgMenuDto> orgUsrTree = orgUsrService.getTree(null, orgUsrService.getCompanyDetailTree(),
// OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment