Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
466
SQL/202510/20251023/lc_basic_safety_information.sql
Normal file
466
SQL/202510/20251023/lc_basic_safety_information.sql
Normal file
File diff suppressed because one or more lines are too long
@@ -19,6 +19,7 @@ import net.sf.jsqlparser.expression.*;
|
|||||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
||||||
|
import net.sf.jsqlparser.expression.operators.relational.GreaterThan;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -195,14 +196,18 @@ public class DeptDataPermissionRule implements DataPermissionRule {
|
|||||||
Expression returnExpression = null;
|
Expression returnExpression = null;
|
||||||
String[] columnNames = columnName.split(",");
|
String[] columnNames = columnName.split(",");
|
||||||
for (String column : columnNames) {
|
for (String column : columnNames) {
|
||||||
Expression deptExpression = new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, column),
|
for (Long deptId : deptIds) {
|
||||||
new ExpressionList(CollectionUtils.convertList(deptIds, LongValue::new)));
|
Expression deptExpression = new GreaterThan()
|
||||||
|
.withLeftExpression(new Function().withName("FIND_IN_SET")
|
||||||
|
.withParameters(new ExpressionList(new StringValue(deptId.toString()), MyBatisUtils.buildColumn(tableName, tableAlias, column))))
|
||||||
|
.withRightExpression(new LongValue(0));
|
||||||
if (Objects.isNull(returnExpression)) {
|
if (Objects.isNull(returnExpression)) {
|
||||||
returnExpression = deptExpression;
|
returnExpression = deptExpression;
|
||||||
} else {
|
} else {
|
||||||
returnExpression = new Parenthesis(new OrExpression(returnExpression, deptExpression));
|
returnExpression = new Parenthesis(new OrExpression(returnExpression, deptExpression));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return returnExpression;
|
return returnExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user