From ab1f42b965c71818588edf040d9cc95c36eda8d2 Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 25 Sep 2019 17:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2API=EF=BC=8C=E6=96=87=E6=A1=A3=E5=90=8E?= =?UTF-8?q?=E9=9D=A2=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/query/QueryConditionKit.java | 26 ++++ .../com/fanruan/api/query/RestrictionKit.java | 146 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 src/main/java/com/fanruan/api/query/QueryConditionKit.java create mode 100644 src/main/java/com/fanruan/api/query/RestrictionKit.java diff --git a/src/main/java/com/fanruan/api/query/QueryConditionKit.java b/src/main/java/com/fanruan/api/query/QueryConditionKit.java new file mode 100644 index 0000000..451781c --- /dev/null +++ b/src/main/java/com/fanruan/api/query/QueryConditionKit.java @@ -0,0 +1,26 @@ +package com.fanruan.api.query; + +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.condition.impl.QueryConditionImpl; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/9/25 + * 查询条件对象 + */ +public class QueryConditionKit { + + private QueryConditionKit() { + + } + + /** + * 创建一个查询条件对象 + * + * @return 查询条件 + */ + public QueryCondition newQueryCondition() { + return new QueryConditionImpl(); + } +} diff --git a/src/main/java/com/fanruan/api/query/RestrictionKit.java b/src/main/java/com/fanruan/api/query/RestrictionKit.java new file mode 100644 index 0000000..0f637be --- /dev/null +++ b/src/main/java/com/fanruan/api/query/RestrictionKit.java @@ -0,0 +1,146 @@ +package com.fanruan.api.query; + +import com.fr.stable.query.data.SubQuery; +import com.fr.stable.query.data.column.Column; +import com.fr.stable.query.restriction.Restriction; +import com.fr.stable.query.restriction.RestrictionFactory; + +import java.util.List; +import java.util.Set; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019/9/25 + * 查询限制条件 + */ +public class RestrictionKit { + + private RestrictionKit() { + + } + + public static Restriction eq(String columnName, Object columnValue) { + return RestrictionFactory.eq(columnName, columnValue); + } + + public static Restriction eq(Column column, Object columnValue) { + return RestrictionFactory.eq(column, columnValue); + } + + public static Restriction gt(String columnName, Object columnValue) { + return RestrictionFactory.gt(columnName, columnValue); + } + + public static Restriction gt(Column column, Object columnValue) { + return RestrictionFactory.gt(column, columnValue); + } + + public static Restriction gte(String columnName, Object columnValue) { + return RestrictionFactory.gte(columnName, columnValue); + } + + public static Restriction gte(Column column, Object columnValue) { + return RestrictionFactory.gte(column, columnValue); + } + + public static Restriction lt(String columnName, Object columnValue) { + return RestrictionFactory.lt(columnName, columnValue); + } + + public static Restriction lt(Column column, Object columnValue) { + return RestrictionFactory.lt(column, columnValue); + } + + public static Restriction lte(String columnName, Object columnValue) { + return RestrictionFactory.lte(columnName, columnValue); + } + + public static Restriction lte(Column column, Object columnValue) { + return RestrictionFactory.lte(column, columnValue); + } + + public static Restriction neq(String columnName, Object columnValue) { + return RestrictionFactory.neq(columnName, columnValue); + } + + public static Restriction neq(Column column, Object columnValue) { + return RestrictionFactory.neq(column, columnValue); + } + + public static Restriction like(String columnName, Object columnValue) { + return RestrictionFactory.like(columnName, columnValue); + } + + public static Restriction like(Column column, Object columnValue) { + return RestrictionFactory.like(column, columnValue); + } + + public static Restriction startWith(String columnName, Object columnValue) { + return RestrictionFactory.startWith(columnName, columnValue); + } + + public static Restriction startWith(Column column, Object columnValue) { + return RestrictionFactory.startWith(column, columnValue); + } + + public static Restriction endWith(String columnName, Object columnValue) { + return RestrictionFactory.endWith(columnName, columnValue); + } + + public static Restriction endWith(Column column, Object columnValue) { + return RestrictionFactory.endWith(column, columnValue); + } + + public static Restriction in(String columnName, Set columnValues) { + return RestrictionFactory.in(columnName, columnValues); + } + + public static Restriction in(Column column, Set columnValues) { + return RestrictionFactory.in(column, columnValues); + } + + public static Restriction inQuery(String columnName, SubQuery query) { + return RestrictionFactory.inQuery(columnName, query); + } + + public static Restriction inQuery(Column column, SubQuery query) { + return RestrictionFactory.inQuery(column, query); + } + + public static Restriction notIn(String columnName, Set columnValues) { + return RestrictionFactory.notIn(columnName, columnValues); + } + + public static Restriction notIn(Column column, Set columnValues) { + return RestrictionFactory.notIn(column, columnValues); + } + + public static Restriction notInQuery(String columnName, SubQuery query) { + return RestrictionFactory.notInQuery(columnName, query); + } + + public static Restriction notInQuery(Column column, SubQuery query) { + return RestrictionFactory.notInQuery(column, query); + } + + public static Restriction or(Restriction... restrictions) { + return RestrictionFactory.or(restrictions); + } + + public static Restriction or(List restrictionList) { + return RestrictionFactory.or(restrictionList); + } + + public static Restriction and(Restriction... restrictions) { + return RestrictionFactory.and(restrictions); + } + + public static Restriction and(List restrictionList) { + return RestrictionFactory.and(restrictionList); + } + + public static Restriction not(Restriction restriction) { + return RestrictionFactory.not(restriction); + } +}