MdoProPythonSQLBuilder.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. package com.miniframe.model.mdo;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. public class MdoProPythonSQLBuilder {
  5. protected String orderByClause;
  6. protected boolean distinct;
  7. protected List<Criteria> oredCriteria;
  8. public MdoProPythonSQLBuilder() {
  9. oredCriteria = new ArrayList<Criteria>();
  10. }
  11. public void setOrderByClause(String orderByClause) {
  12. this.orderByClause = orderByClause;
  13. }
  14. public String getOrderByClause() {
  15. return orderByClause;
  16. }
  17. public void setDistinct(boolean distinct) {
  18. this.distinct = distinct;
  19. }
  20. public boolean isDistinct() {
  21. return distinct;
  22. }
  23. public List<Criteria> getOredCriteria() {
  24. return oredCriteria;
  25. }
  26. public void or(Criteria criteria) {
  27. oredCriteria.add(criteria);
  28. }
  29. public Criteria or() {
  30. Criteria criteria = createCriteriaInternal();
  31. oredCriteria.add(criteria);
  32. return criteria;
  33. }
  34. public Criteria createCriteria() {
  35. Criteria criteria = createCriteriaInternal();
  36. if (oredCriteria.size() == 0) {
  37. oredCriteria.add(criteria);
  38. }
  39. return criteria;
  40. }
  41. protected Criteria createCriteriaInternal() {
  42. Criteria criteria = new Criteria();
  43. return criteria;
  44. }
  45. public void clear() {
  46. oredCriteria.clear();
  47. orderByClause = null;
  48. distinct = false;
  49. }
  50. protected abstract static class GeneratedCriteria {
  51. protected List<Criterion> criteria;
  52. protected GeneratedCriteria() {
  53. super();
  54. criteria = new ArrayList<Criterion>();
  55. }
  56. public boolean isValid() {
  57. return criteria.size() > 0;
  58. }
  59. public List<Criterion> getAllCriteria() {
  60. return criteria;
  61. }
  62. public List<Criterion> getCriteria() {
  63. return criteria;
  64. }
  65. protected void addCriterion(String condition) {
  66. if (condition == null) {
  67. throw new RuntimeException("Value for condition cannot be null");
  68. }
  69. criteria.add(new Criterion(condition));
  70. }
  71. protected void addCriterion(String condition, Object value, String property) {
  72. if (value == null) {
  73. throw new RuntimeException("Value for " + property + " cannot be null");
  74. }
  75. criteria.add(new Criterion(condition, value));
  76. }
  77. protected void addCriterion(String condition, Object value1, Object value2, String property) {
  78. if (value1 == null || value2 == null) {
  79. throw new RuntimeException("Between values for " + property + " cannot be null");
  80. }
  81. criteria.add(new Criterion(condition, value1, value2));
  82. }
  83. public Criteria andIdIsNull() {
  84. addCriterion("id is null");
  85. return (Criteria) this;
  86. }
  87. public Criteria andIdIsNotNull() {
  88. addCriterion("id is not null");
  89. return (Criteria) this;
  90. }
  91. public Criteria andIdEqualTo(String value) {
  92. addCriterion("id =", value, "id");
  93. return (Criteria) this;
  94. }
  95. public Criteria andIdNotEqualTo(String value) {
  96. addCriterion("id <>", value, "id");
  97. return (Criteria) this;
  98. }
  99. public Criteria andIdGreaterThan(String value) {
  100. addCriterion("id >", value, "id");
  101. return (Criteria) this;
  102. }
  103. public Criteria andIdGreaterThanOrEqualTo(String value) {
  104. addCriterion("id >=", value, "id");
  105. return (Criteria) this;
  106. }
  107. public Criteria andIdLessThan(String value) {
  108. addCriterion("id <", value, "id");
  109. return (Criteria) this;
  110. }
  111. public Criteria andIdLessThanOrEqualTo(String value) {
  112. addCriterion("id <=", value, "id");
  113. return (Criteria) this;
  114. }
  115. public Criteria andIdLike(String value) {
  116. addCriterion("id like", value, "id");
  117. return (Criteria) this;
  118. }
  119. public Criteria andIdNotLike(String value) {
  120. addCriterion("id not like", value, "id");
  121. return (Criteria) this;
  122. }
  123. public Criteria andIdIn(List<String> values) {
  124. addCriterion("id in", values, "id");
  125. return (Criteria) this;
  126. }
  127. public Criteria andIdNotIn(List<String> values) {
  128. addCriterion("id not in", values, "id");
  129. return (Criteria) this;
  130. }
  131. public Criteria andIdBetween(String value1, String value2) {
  132. addCriterion("id between", value1, value2, "id");
  133. return (Criteria) this;
  134. }
  135. public Criteria andIdNotBetween(String value1, String value2) {
  136. addCriterion("id not between", value1, value2, "id");
  137. return (Criteria) this;
  138. }
  139. public Criteria andPidIsNull() {
  140. addCriterion("pid is null");
  141. return (Criteria) this;
  142. }
  143. public Criteria andPidIsNotNull() {
  144. addCriterion("pid is not null");
  145. return (Criteria) this;
  146. }
  147. public Criteria andPidEqualTo(String value) {
  148. addCriterion("pid =", value, "pid");
  149. return (Criteria) this;
  150. }
  151. public Criteria andPidNotEqualTo(String value) {
  152. addCriterion("pid <>", value, "pid");
  153. return (Criteria) this;
  154. }
  155. public Criteria andPidGreaterThan(String value) {
  156. addCriterion("pid >", value, "pid");
  157. return (Criteria) this;
  158. }
  159. public Criteria andPidGreaterThanOrEqualTo(String value) {
  160. addCriterion("pid >=", value, "pid");
  161. return (Criteria) this;
  162. }
  163. public Criteria andPidLessThan(String value) {
  164. addCriterion("pid <", value, "pid");
  165. return (Criteria) this;
  166. }
  167. public Criteria andPidLessThanOrEqualTo(String value) {
  168. addCriterion("pid <=", value, "pid");
  169. return (Criteria) this;
  170. }
  171. public Criteria andPidLike(String value) {
  172. addCriterion("pid like", value, "pid");
  173. return (Criteria) this;
  174. }
  175. public Criteria andPidNotLike(String value) {
  176. addCriterion("pid not like", value, "pid");
  177. return (Criteria) this;
  178. }
  179. public Criteria andPidIn(List<String> values) {
  180. addCriterion("pid in", values, "pid");
  181. return (Criteria) this;
  182. }
  183. public Criteria andPidNotIn(List<String> values) {
  184. addCriterion("pid not in", values, "pid");
  185. return (Criteria) this;
  186. }
  187. public Criteria andPidBetween(String value1, String value2) {
  188. addCriterion("pid between", value1, value2, "pid");
  189. return (Criteria) this;
  190. }
  191. public Criteria andPidNotBetween(String value1, String value2) {
  192. addCriterion("pid not between", value1, value2, "pid");
  193. return (Criteria) this;
  194. }
  195. public Criteria andPtythonIsNull() {
  196. addCriterion("ptython is null");
  197. return (Criteria) this;
  198. }
  199. public Criteria andPtythonIsNotNull() {
  200. addCriterion("ptython is not null");
  201. return (Criteria) this;
  202. }
  203. public Criteria andPtythonEqualTo(String value) {
  204. addCriterion("ptython =", value, "ptython");
  205. return (Criteria) this;
  206. }
  207. public Criteria andPtythonNotEqualTo(String value) {
  208. addCriterion("ptython <>", value, "ptython");
  209. return (Criteria) this;
  210. }
  211. public Criteria andPtythonGreaterThan(String value) {
  212. addCriterion("ptython >", value, "ptython");
  213. return (Criteria) this;
  214. }
  215. public Criteria andPtythonGreaterThanOrEqualTo(String value) {
  216. addCriterion("ptython >=", value, "ptython");
  217. return (Criteria) this;
  218. }
  219. public Criteria andPtythonLessThan(String value) {
  220. addCriterion("ptython <", value, "ptython");
  221. return (Criteria) this;
  222. }
  223. public Criteria andPtythonLessThanOrEqualTo(String value) {
  224. addCriterion("ptython <=", value, "ptython");
  225. return (Criteria) this;
  226. }
  227. public Criteria andPtythonLike(String value) {
  228. addCriterion("ptython like", value, "ptython");
  229. return (Criteria) this;
  230. }
  231. public Criteria andPtythonNotLike(String value) {
  232. addCriterion("ptython not like", value, "ptython");
  233. return (Criteria) this;
  234. }
  235. public Criteria andPtythonIn(List<String> values) {
  236. addCriterion("ptython in", values, "ptython");
  237. return (Criteria) this;
  238. }
  239. public Criteria andPtythonNotIn(List<String> values) {
  240. addCriterion("ptython not in", values, "ptython");
  241. return (Criteria) this;
  242. }
  243. public Criteria andPtythonBetween(String value1, String value2) {
  244. addCriterion("ptython between", value1, value2, "ptython");
  245. return (Criteria) this;
  246. }
  247. public Criteria andPtythonNotBetween(String value1, String value2) {
  248. addCriterion("ptython not between", value1, value2, "ptython");
  249. return (Criteria) this;
  250. }
  251. }
  252. public static class Criteria extends GeneratedCriteria {
  253. protected Criteria() {
  254. super();
  255. }
  256. }
  257. public static class Criterion {
  258. private String condition;
  259. private Object value;
  260. private Object secondValue;
  261. private boolean noValue;
  262. private boolean singleValue;
  263. private boolean betweenValue;
  264. private boolean listValue;
  265. private String typeHandler;
  266. public String getCondition() {
  267. return condition;
  268. }
  269. public Object getValue() {
  270. return value;
  271. }
  272. public Object getSecondValue() {
  273. return secondValue;
  274. }
  275. public boolean isNoValue() {
  276. return noValue;
  277. }
  278. public boolean isSingleValue() {
  279. return singleValue;
  280. }
  281. public boolean isBetweenValue() {
  282. return betweenValue;
  283. }
  284. public boolean isListValue() {
  285. return listValue;
  286. }
  287. public String getTypeHandler() {
  288. return typeHandler;
  289. }
  290. protected Criterion(String condition) {
  291. super();
  292. this.condition = condition;
  293. this.typeHandler = null;
  294. this.noValue = true;
  295. }
  296. protected Criterion(String condition, Object value, String typeHandler) {
  297. super();
  298. this.condition = condition;
  299. this.value = value;
  300. this.typeHandler = typeHandler;
  301. if (value instanceof List<?>) {
  302. this.listValue = true;
  303. } else {
  304. this.singleValue = true;
  305. }
  306. }
  307. protected Criterion(String condition, Object value) {
  308. this(condition, value, null);
  309. }
  310. protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
  311. super();
  312. this.condition = condition;
  313. this.value = value;
  314. this.secondValue = secondValue;
  315. this.typeHandler = typeHandler;
  316. this.betweenValue = true;
  317. }
  318. protected Criterion(String condition, Object value, Object secondValue) {
  319. this(condition, value, secondValue, null);
  320. }
  321. }
  322. }