| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.sf.jsqlparser.JSQLParserException; |
| | | import net.sf.jsqlparser.expression.Expression; |
| | | import net.sf.jsqlparser.expression.Parenthesis; |
| | | import net.sf.jsqlparser.expression.operators.conditional.AndExpression; |
| | | import net.sf.jsqlparser.expression.operators.relational.ParenthesedExpressionList; |
| | | import net.sf.jsqlparser.parser.CCJSqlParserUtil; |
| | | import org.apache.ibatis.io.Resources; |
| | | import org.dromara.common.core.domain.dto.RoleDTO; |
| | |
| | | try { |
| | | Expression expression = CCJSqlParserUtil.parseExpression(dataFilterSql); |
| | | // 数据权限使用单独的括号 防止与其他条件冲突 |
| | | Parenthesis parenthesis = new Parenthesis(expression); |
| | | ParenthesedExpressionList<Expression> parenthesis = new ParenthesedExpressionList<>(expression); |
| | | if (ObjectUtil.isNotNull(where)) { |
| | | return new AndExpression(where, parenthesis); |
| | | } else { |
| | |
| | | )) { |
| | | continue; |
| | | } |
| | | // 包含权限标识符 这直接跳过 |
| | | if (StringUtils.isNotBlank(dataColumn.permission()) && |
| | | CollUtil.contains(user.getMenuPermission(), dataColumn.permission()) |
| | | ) { |
| | | isSuccess = true; |
| | | continue; |
| | | } |
| | | // 设置注解变量 key 为表达式变量 value 为变量值 |
| | | for (int i = 0; i < dataColumn.key().length; i++) { |
| | | context.setVariable(dataColumn.key()[i], dataColumn.value()[i]); |