Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
cn.cloudself.demo.java.dao.zz.ZzUserQueryPro Maven / Gradle / Ivy
package cn.cloudself.demo.java.dao.zz;
import cn.cloudself.query.util.log.Log;
import cn.cloudself.query.util.log.LogFactory;
import cn.cloudself.demo.java.entity.ZzUser;
import cn.cloudself.query.*;
import cn.cloudself.query.psi.*;
import cn.cloudself.query.psi.structure.*;
import cn.cloudself.query.exception.IllegalCall;
import cn.cloudself.query.util.iterator.ListEx;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.function.Function;
import java.util.List;
import java.util.Map;
@SuppressWarnings("unused")
public class ZzUserQueryPro {
private static final Log logger = LogFactory.getLog(__Impl.class);
private static QueryStructure defQueryStructure() {
final QueryStructure queryStructure = new QueryStructure();
queryStructure.from(new QueryStructureFrom(__Impl.TABLE_NAME));
return queryStructure;
}
private static QueryPro<
ZzUser,
Long,
__Impl.WhereField>,
__Impl.OrderByField>,
__Impl.UpdateSetField,
__Impl.WhereField,
__Impl.WhereField
> createQuery() {
return new QueryPro<>(
ZzUserQueryPro.class,
ZzUser.class,
defQueryStructure(),
(qs, payload) -> new __Impl.WhereField<>(qs, payload, ZzUser.class),
(qs, payload) -> new __Impl.OrderByField<>(qs, payload, ZzUser.class),
__Impl.UpdateSetField::new,
(qs, payload) -> new __Impl.WhereField<>(qs, payload, Boolean.class),
(qs, payload) -> new __Impl.WhereField<>(qs, payload, Boolean.class)
);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> bt(boolean arg0) {
return createQuery().bt(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> connection(java.sql.Connection arg0) {
return createQuery().connection(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> dataSource(javax.sql.DataSource arg0) {
return createQuery().dataSource(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> dbType(cn.cloudself.query.config.IQueryProConfig.DatabaseType arg0) {
return createQuery().dbType(arg0);
}
public static boolean deleteByPrimaryKey(Object arg0) {
return createQuery().deleteByPrimaryKey(arg0);
}
public static __Impl.WhereField deleteBy() {
return createQuery().deleteBy();
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> dryRun(boolean arg0) {
return createQuery().dryRun(arg0);
}
public static Long insert(ZzUser arg0) {
return createQuery().insert(arg0);
}
public static java.util.List insert(ZzUser ...arg0) {
return createQuery().insert(arg0);
}
public static java.util.List insert(java.util.Collection arg0) {
return createQuery().insert(arg0);
}
@SafeVarargs
public static java.util.List insert(java.util.Map ...arg0) {
return createQuery().insert(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> logicDelete(boolean arg0, String arg1, Object arg2, Object arg3) {
return createQuery().logicDelete(arg0, arg1, arg2, arg3);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> logicDelete(boolean arg0) {
return createQuery().logicDelete(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> maxParameterSize(int arg0) {
return createQuery().maxParameterSize(arg0);
}
public static __Impl.OrderByField> orderBy() {
return createQuery().orderBy();
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> pcb(boolean arg0, cn.cloudself.query.util.log.LogLevel arg1) {
return createQuery().pcb(arg0, arg1);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> pcb(boolean arg0) {
return createQuery().pcb(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> pl(boolean arg0, cn.cloudself.query.util.log.LogLevel arg1) {
return createQuery().pl(arg0, arg1);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> pl(boolean arg0) {
return createQuery().pl(arg0);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> ple(boolean arg0) {
return createQuery().ple(arg0);
}
public static cn.cloudself.query.plus.QueryProPlus plus(String arg0) {
return createQuery().plus(arg0);
}
public static cn.cloudself.query.plus.QueryProPlus plus() {
return createQuery().plus();
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> pr(boolean arg0, cn.cloudself.query.util.log.LogLevel arg1) {
return createQuery().pr(arg0, arg1);
}
public static cn.cloudself.query.QueryPro>, __Impl.OrderByField>, __Impl.UpdateSetField, __Impl.WhereField, __Impl.WhereField> pr(boolean arg0) {
return createQuery().pr(arg0);
}
public static java.util.List selectAll() {
return createQuery().selectAll();
}
public static __Impl.WhereField> selectByObj(ZzUser arg0) {
return createQuery().selectByObj(arg0);
}
public static ZzUser selectByPrimaryKey(Object arg0) {
return createQuery().selectByPrimaryKey(arg0);
}
public static __Impl.WhereField> selectBy() {
return createQuery().selectBy();
}
@Contract(pure = true)
public static cn.cloudself.query.psi.UpdateSetDefinedExpression<__Impl.WhereField> updateSet(ZzUser arg0, boolean arg1) {
return createQuery().updateSet(arg0, arg1);
}
@Contract(pure = true)
public static cn.cloudself.query.psi.UpdateSetDefinedExpression<__Impl.WhereField> updateSet(ZzUser arg0) {
return createQuery().updateSet(arg0);
}
@Contract(pure = true)
public static cn.cloudself.query.psi.UpdateSetDefinedExpression<__Impl.WhereField> updateSet(java.util.Map arg0) {
return createQuery().updateSet(arg0);
}
@Contract(pure = true)
public static __Impl.UpdateSetField updateSet() {
return createQuery().updateSet();
}
public static class __Impl {
private static final Class CLAZZ = ZzUser.class;
public static final String TABLE_NAME = "user";
private static Field createField(String column) { return new Field(TABLE_NAME, column); }
public abstract static class CommonField extends AbstractExpression, OrderByField, ColumnLimiterField, ColumnsLimiterField> {
protected final QueryStructure queryStructure;
protected final QueryPayload payload;
protected final Class clazz;
CommonField(QueryStructure queryStructure, QueryPayload payload, Class clazz) {
super();
this.queryStructure = queryStructure;
this.payload = payload;
this.clazz = clazz;
}
@NotNull @Override protected QueryStructure getQueryStructure() { return queryStructure; }
@NotNull @Override public QueryPayload getPayload() { return payload; }
@NotNull @Override public Class getClazz() { return clazz; }
@NotNull @Override protected WhereField createWhereField(@NotNull QueryStructure qs, @NotNull QueryPayload payload) { return new WhereField<>(qs, payload, clazz); }
@NotNull @Override protected OrderByField createOrderByField(@NotNull QueryStructure qs, @NotNull QueryPayload payload) { return new OrderByField<>(qs, payload, clazz); }
@NotNull @Override protected ColumnLimiterField createColumnLimitField(@NotNull QueryStructure qs, @NotNull QueryPayload payload) { return new ColumnLimiterField<>(qs, payload, clazz); }
@NotNull @Override protected ColumnsLimiterField createColumnsLimitField(@NotNull QueryStructure qs, @NotNull QueryPayload payload) { return new ColumnsLimiterField<>(qs, payload, clazz); }
}
public static class WhereField extends CommonField {
public WhereField(QueryStructure qs, QueryPayload payload, Class clazz) { super(qs, payload, clazz); }
@NotNull @Override protected ExpressionType getFieldType() { return ExpressionType.WHERE; }
private Keywords> createWhereField(String column) {
return new Keywords<>(new Field(TABLE_NAME, column), queryStructure, payload, super::createWhereField);
}
private WhereField createWhereField(String column, Object[] objs) {
final Keywords> whereField = createWhereField(column);
return objs.length == 1 ? whereField.equalTo(objs[0]) : whereField.in(objs);
}
@Contract(pure = true)
public Keywords> id() { return createWhereField("id"); }
@Contract(pure = true)
public WhereField id(List idList) { return createWhereField("id", idList.toArray(new Object[0])); }
@Contract(pure = true)
public WhereField id(Long... ids) { return createWhereField("id", ids); }
@Contract(pure = true)
public Keywords> name() { return createWhereField("name"); }
@Contract(pure = true)
public WhereField name(List nameList) { return createWhereField("name", nameList.toArray(new Object[0])); }
@Contract(pure = true)
public WhereField name(String... names) { return createWhereField("name", names); }
@Contract(pure = true)
public Keywords> age() { return createWhereField("age"); }
@Contract(pure = true)
public WhereField age(List ageList) { return createWhereField("age", ageList.toArray(new Object[0])); }
@Contract(pure = true)
public WhereField age(Integer... ages) { return createWhereField("age", ages); }
@Contract(pure = true)
public Keywords> sex() { return createWhereField("sex"); }
@Contract(pure = true)
public WhereField sex(List sexList) { return createWhereField("sex", sexList.toArray(new Object[0])); }
@Contract(pure = true)
public WhereField sex(String... sexs) { return createWhereField("sex", sexs); }
@Contract(pure = true)
public Keywords> deleted() { return createWhereField("deleted"); }
@Contract(pure = true)
public WhereField deleted(List deletedList) { return createWhereField("deleted", deletedList.toArray(new Object[0])); }
@Contract(pure = true)
public WhereField deleted(Boolean... deleteds) { return createWhereField("deleted", deleteds); }
@Contract(pure = true)
public WhereField take(Function, WhereField> factor) {
return factor.apply(this);
}
}
public static class OrderByField extends CommonField {
public OrderByField(QueryStructure qs, QueryPayload payload, Class clazz) { super(qs, payload, clazz); }
@NotNull @Override protected ExpressionType getFieldType() { return ExpressionType.ORDER_BY; }
private KeywordsOrderBy> createOrderByField(String column) {
return new KeywordsOrderBy<>(new Field(TABLE_NAME, column), queryStructure, payload, super::createOrderByField);
}
@Contract(pure = true)
public KeywordsOrderBy> id() { return createOrderByField("id"); }
@Contract(pure = true)
public KeywordsOrderBy> name() { return createOrderByField("name"); }
@Contract(pure = true)
public KeywordsOrderBy> age() { return createOrderByField("age"); }
@Contract(pure = true)
public KeywordsOrderBy> sex() { return createOrderByField("sex"); }
@Contract(pure = true)
public KeywordsOrderBy> deleted() { return createOrderByField("deleted"); }
@Contract(pure = true)
public OrderByField take(Function, OrderByField> factor) {
return factor.apply(this);
}
}
public static class ColumnLimiterField extends CommonField {
public ColumnLimiterField(QueryStructure qs, QueryPayload payload, Class clazz) { super(qs, payload, clazz); }
@NotNull @Override protected ExpressionType getFieldType() { return ExpressionType.COLUMN_LIMITER; }
private ListEx createColumnLimiterField(String column, Class clazz) {
return new ListEx<>(getColumn(new Field(TABLE_NAME, column), clazz));
}
public ListEx id() { return createColumnLimiterField("id", Long.class); }
public ListEx name() { return createColumnLimiterField("name", String.class); }
public ListEx age() { return createColumnLimiterField("age", Integer.class); }
public ListEx sex() { return createColumnLimiterField("sex", String.class); }
public ListEx deleted() { return createColumnLimiterField("deleted", Boolean.class); }
public R take(Function, R> factor) {
return factor.apply(this);
}
}
public static class ColumnsLimiterField extends CommonField {
public ColumnsLimiterField(QueryStructure qs, QueryPayload payload, Class clazz) { super(qs, payload, clazz); }
@NotNull @Override protected ExpressionType getFieldType() { return ExpressionType.COLUMNS_LIMITER; }
@SuppressWarnings("DuplicatedCode")
private ColumnsLimiterField createColumnsLimiterField(String column) {
final QueryStructure queryStructure = getQueryStructure();
queryStructure.appendField(new Field(TABLE_NAME, column));
return new ColumnsLimiterField<>(queryStructure, payload, clazz);
}
@Contract(pure = true)
public ColumnsLimiterField id() { return createColumnsLimiterField("id"); }
@Contract(pure = true)
public ColumnsLimiterField name() { return createColumnsLimiterField("name"); }
@Contract(pure = true)
public ColumnsLimiterField age() { return createColumnsLimiterField("age"); }
@Contract(pure = true)
public ColumnsLimiterField sex() { return createColumnsLimiterField("sex"); }
@Contract(pure = true)
public ColumnsLimiterField deleted() { return createColumnsLimiterField("deleted"); }
@Contract(pure = true)
public ColumnsLimiterField take(Function, ColumnsLimiterField> factor) {
return factor.apply(this);
}
}
public static class UpdateSetField extends UpdateSetDefinedExpression> {
private final QueryStructure queryStructure;
public UpdateSetField(QueryStructure qs, QueryPayload payload) {
super(qs, payload, (q, p) -> new WhereField<>(q, p, Boolean.class));
this.queryStructure = qs;
}
@SuppressWarnings("DuplicatedCode")
private UpdateSetField createUpdateSetField(String key, Object value) {
final Update update = queryStructure.update();
if (update == null) {
throw new IllegalCall("usage like: UserQueryPro.updateSet().id(1).name(name).run()");
}
if (value == null) {
logger.error("null值不能直接updateSet, 使用Const.NULL代替, usage like: UserQueryPro.updateSet().name(Const.NULL).where().id(1).run()");
}
@SuppressWarnings("unchecked") final Map map = (Map) update.data();
assert map != null;
map.put(key, value);
return this;
}
@Contract(pure = true)
public UpdateSetField id(Object id) { return createUpdateSetField("id", id); }
@Contract(pure = true)
public UpdateSetField name(Object name) { return createUpdateSetField("name", name); }
@Contract(pure = true)
public UpdateSetField age(Object age) { return createUpdateSetField("age", age); }
@Contract(pure = true)
public UpdateSetField sex(Object sex) { return createUpdateSetField("sex", sex); }
@Contract(pure = true)
public UpdateSetField deleted(Object deleted) { return createUpdateSetField("deleted", deleted); }
@Contract(pure = true)
public UpdateSetField take(Function factor) {
return factor.apply(this);
}
}
}
}