|
@@ -211,7 +211,6 @@ public class PermissionAspect implements Interceptor {
|
|
|
if(null != post && post.getKeyValue().equals("JCDW")){
|
|
|
|
|
|
boolean type = null != methodNames.get(newId + "-" + newName+"type") ?methodNames.get(newId + "-" + newName+"type") :false;
|
|
|
- System.out.println("***********sssss="+methodNames.get(newId + "-" + newName+"type"));
|
|
|
if (type) {
|
|
|
sql = getSql(sql, organizationId,"JCDW");
|
|
|
}
|
|
@@ -250,7 +249,7 @@ public class PermissionAspect implements Interceptor {
|
|
|
|
|
|
condition = table.getAlias().getName() + "." + ORGANIZATION_ID + "='" + deptId + "'";;
|
|
|
} else {
|
|
|
- condition = table.getAlias().getName() + "." + DEPT_ID + "='" + deptId + "'";;
|
|
|
+ condition = table.getAlias().getName() + "." + DEPT_ID + "='" + deptId + "' or "+table.getAlias().getName() + "." + DEPT_ID + "='PUBLIC'";;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -261,12 +260,17 @@ public class PermissionAspect implements Interceptor {
|
|
|
final Expression expression = plainSelect.getWhere();
|
|
|
//增加新的where条件
|
|
|
final Expression envCondition = CCJSqlParserUtil.parseCondExpression(condition);
|
|
|
- if (expression == null) {
|
|
|
- plainSelect.setWhere(envCondition);
|
|
|
- } else {
|
|
|
- AndExpression andExpression = new AndExpression(expression, envCondition);
|
|
|
- plainSelect.setWhere(andExpression);
|
|
|
+ //envCondition.toString().contains(envCondition.toString());
|
|
|
+ System.out.println();
|
|
|
+ if(StringUtils.isNotBlank(envCondition.toString()) && !expression.toString().contains(envCondition.toString())){
|
|
|
+ if (expression == null) {
|
|
|
+ plainSelect.setWhere(envCondition);
|
|
|
+ } else {
|
|
|
+ AndExpression andExpression = new AndExpression(expression, envCondition);
|
|
|
+ plainSelect.setWhere(andExpression);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return plainSelect.toString();
|
|
|
} catch (JSQLParserException e) {
|
|
|
log.error("解析原SQL并构建新SQL错误:" + e);
|