Browse Source

配置数据库查询API,文档后面补

remotes/1611766341912730171/master
richie 5 years ago
parent
commit
ab1f42b965
  1. 26
      src/main/java/com/fanruan/api/query/QueryConditionKit.java
  2. 146
      src/main/java/com/fanruan/api/query/RestrictionKit.java

26
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();
}
}

146
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<Restriction> restrictionList) {
return RestrictionFactory.or(restrictionList);
}
public static Restriction and(Restriction... restrictions) {
return RestrictionFactory.and(restrictions);
}
public static Restriction and(List<Restriction> restrictionList) {
return RestrictionFactory.and(restrictionList);
}
public static Restriction not(Restriction restriction) {
return RestrictionFactory.not(restriction);
}
}
Loading…
Cancel
Save