BindQuery动态join添加逻辑删除条件及支持附件条件
This commit is contained in:
parent
2f1d06b8f6
commit
a980b290bb
|
@ -86,9 +86,15 @@ public class DynamicSqlProvider {
|
|||
List<AnnoJoiner> annoJoinerList = wrapper.getAnnoJoiners();
|
||||
if(V.notEmpty(annoJoinerList)){
|
||||
Set<String> tempSet = new HashSet<>();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(AnnoJoiner joiner : annoJoinerList){
|
||||
if(V.notEmpty(joiner.getJoin()) && V.notEmpty(joiner.getOnSegment())){
|
||||
String joinSegment = joiner.getJoin() + " " + joiner.getAlias() + " ON " + joiner.getOnSegment();
|
||||
sb.setLength(0);
|
||||
sb.append(joiner.getJoin()).append(" ").append(joiner.getAlias()).append(" ON ").append(joiner.getOnSegment());
|
||||
if(S.containsIgnoreCase(joiner.getOnSegment(), " "+Cons.COLUMN_IS_DELETED) == false && ParserCache.hasDeletedColumn(joiner.getJoin())){
|
||||
sb.append(" AND ").append(joiner.getAlias()).append(".").append(Cons.COLUMN_IS_DELETED).append(" = ").append(BaseConfig.getActiveFlagValue());
|
||||
}
|
||||
String joinSegment = sb.toString();
|
||||
if(!tempSet.contains(joinSegment)){
|
||||
LEFT_OUTER_JOIN(joinSegment);
|
||||
tempSet.add(joinSegment);
|
||||
|
|
|
@ -69,6 +69,9 @@ public class JoinConditionParser {
|
|||
if(expression.getRightExpression() instanceof Column){
|
||||
right = alias + "." + right;
|
||||
}
|
||||
else if(expression.getLeftExpression() instanceof Column){
|
||||
left = alias + "." + left;
|
||||
}
|
||||
if(operator instanceof EqualsTo){
|
||||
segments.add(left + " = " + right);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue