1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.dynamic.sql.common;
17
18 import org.jspecify.annotations.Nullable;
19 import org.mybatis.dynamic.sql.SqlTable;
20 import org.mybatis.dynamic.sql.configuration.StatementConfiguration;
21 import org.mybatis.dynamic.sql.where.EmbeddedWhereModel;
22
23
24
25
26
27
28 public abstract class CommonBuilder<T extends CommonBuilder<T>> {
29 private @Nullable SqlTable table;
30 private @Nullable String tableAlias;
31 private @Nullable EmbeddedWhereModel whereModel;
32 private @Nullable Long limit;
33 private @Nullable OrderByModel orderByModel;
34 private @Nullable StatementConfiguration statementConfiguration;
35
36 public @Nullable SqlTable table() {
37 return table;
38 }
39
40 public @Nullable String tableAlias() {
41 return tableAlias;
42 }
43
44 public @Nullable EmbeddedWhereModel whereModel() {
45 return whereModel;
46 }
47
48 public @Nullable Long limit() {
49 return limit;
50 }
51
52 public @Nullable OrderByModel orderByModel() {
53 return orderByModel;
54 }
55
56 public @Nullable StatementConfiguration statementConfiguration() {
57 return statementConfiguration;
58 }
59
60 public T withTable(SqlTable table) {
61 this.table = table;
62 return getThis();
63 }
64
65 public T withTableAlias(@Nullable String tableAlias) {
66 this.tableAlias = tableAlias;
67 return getThis();
68 }
69
70 public T withWhereModel(@Nullable EmbeddedWhereModel whereModel) {
71 this.whereModel = whereModel;
72 return getThis();
73 }
74
75 public T withLimit(@Nullable Long limit) {
76 this.limit = limit;
77 return getThis();
78 }
79
80 public T withOrderByModel(@Nullable OrderByModel orderByModel) {
81 this.orderByModel = orderByModel;
82 return getThis();
83 }
84
85 public T withStatementConfiguration(StatementConfiguration statementConfiguration) {
86 this.statementConfiguration = statementConfiguration;
87 return getThis();
88 }
89
90 protected abstract T getThis();
91 }