|
@@ -1,4 +1,19 @@
|
|
-package com.baomidou.mybatisplus.core.toolkit.iSqlSegments;
|
|
|
|
|
|
+/*
|
|
|
|
+ * Copyright (c) 2011-2020, hubin (jobob@qq.com).
|
|
|
|
+ * <p>
|
|
|
|
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
|
+ * use this file except in compliance with the License. You may obtain a copy of
|
|
|
|
+ * the License at
|
|
|
|
+ * <p>
|
|
|
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
+ * <p>
|
|
|
|
+ * Unless required by applicable law or agreed to in writing, software
|
|
|
|
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
+ * License for the specific language governing permissions and limitations under
|
|
|
|
+ * the License.
|
|
|
|
+ */
|
|
|
|
+package com.baomidou.mybatisplus.core.toolkit.sql.segments;
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -11,23 +26,23 @@ import com.baomidou.mybatisplus.core.enums.SqlKeyword;
|
|
* @author miemie
|
|
* @author miemie
|
|
* @since 2018-06-27
|
|
* @since 2018-06-27
|
|
*/
|
|
*/
|
|
-public class JoinISqlSegment implements ISqlSegment {
|
|
|
|
|
|
+public class JoinSegment implements ISqlSegment {
|
|
|
|
|
|
private static final long serialVersionUID = 8401728865419013555L;
|
|
private static final long serialVersionUID = 8401728865419013555L;
|
|
|
|
|
|
- private NormalISqlSegment normalISqlSegment = new NormalISqlSegment();
|
|
|
|
- private GroupByISqlSegment groupByISqlSegment = new GroupByISqlSegment();
|
|
|
|
- private OrderByISqlSegment orderByISqlSegment = new OrderByISqlSegment();
|
|
|
|
|
|
+ private NormalSegment normalSegment = new NormalSegment();
|
|
|
|
+ private GroupBySegment groupBySegment = new GroupBySegment();
|
|
|
|
+ private OrderBySegment orderBySegment = new OrderBySegment();
|
|
|
|
|
|
public void add(ISqlSegment... iSqlSegments) {
|
|
public void add(ISqlSegment... iSqlSegments) {
|
|
List<ISqlSegment> list = Arrays.asList(iSqlSegments);
|
|
List<ISqlSegment> list = Arrays.asList(iSqlSegments);
|
|
ISqlSegment sqlSegment = list.get(0);
|
|
ISqlSegment sqlSegment = list.get(0);
|
|
if (match(PredicateStrategy.ORDER_BY, sqlSegment)) {
|
|
if (match(PredicateStrategy.ORDER_BY, sqlSegment)) {
|
|
- orderByISqlSegment.addAll(list);
|
|
|
|
|
|
+ orderBySegment.addAll(list);
|
|
} else if (match(PredicateStrategy.GROUP_BY, sqlSegment)) {
|
|
} else if (match(PredicateStrategy.GROUP_BY, sqlSegment)) {
|
|
- groupByISqlSegment.addAll(list);
|
|
|
|
|
|
+ groupBySegment.addAll(list);
|
|
} else {
|
|
} else {
|
|
- normalISqlSegment.addAll(list);
|
|
|
|
|
|
+ normalSegment.addAll(list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -37,7 +52,7 @@ public class JoinISqlSegment implements ISqlSegment {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String getSqlSegment() {
|
|
public String getSqlSegment() {
|
|
- return normalISqlSegment.getSqlSegment() + groupByISqlSegment.getSqlSegment() + orderByISqlSegment.getSqlSegment();
|
|
|
|
|
|
+ return normalSegment.getSqlSegment() + groupBySegment.getSqlSegment() + orderBySegment.getSqlSegment();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|