//lambdaCnd工具类 jar包地址: wk-starter-database-8.0.0.jar
public class CndWrapper extends Cnd {
public CndWrapper() {
}
public static CndWrapper NEW() {
return new CndWrapper();
}
public static <T> CndWrapper where(PFun<T, ?> fn, Object value) {
return where(fn, "=", value);
}
public static <T> CndWrapper where(PFun<T, ?> fn, String op, Object value) {
CndWrapper wrapper = NEW();
wrapper.and(fn, op, value);
return wrapper;
}
public <T> CndWrapper andIsEmpty(PFun<T, ?> fn) {
super.and(Cnd.exps(Exps.isNull(fn)).or(fn, "=", ""));
return this;
}
public <T> CndWrapper andIsNotEmpty(PFun<T, ?> fn) {
super.and(Cnd.exps(Exps.isNull(fn).setNot(true)).and(fn, "<>", ""));
return this;
}
public <T> CndWrapper andIsNull(PFun<T, ?> fn) {
super.and(Exps.isNull(fn));
return this;
}
public <T> CndWrapper andIsNotNull(PFun<T, ?> fn) {
super.and(Exps.isNull(fn).setNot(true));
return this;
}
public <T> CndWrapper andEqualTo(PFun<T, ?> fn, Object value) {
super.and(fn, " = ", value);
return this;
}
public <T> CndWrapper orEqualTo(PFun<T, ?> fn, Object value) {
super.or(fn, " = ", value);
return this;
}
public <T> CndWrapper andNotEqualTo(PFun<T, ?> fn, Object value) {
super.and(fn, " <> ", value);
return this;
}
public <T> CndWrapper andIn(PFun<T, ?> fn, Object value) {
super.and(fn, " in ", value);
return this;
}
public <T> CndWrapper andNotIn(PFun<T, ?> fn, Object value) {
super.and(fn, " not in ", value);
return this;
}
public <T> CndWrapper andLike(PFun<T, ?> fn, String value, Consumer<Like>... consumer) {
Like like = this.createLike(fn, value, false, consumer);
super.and(like);
return this;
}
public <T> CndWrapper andRightLike(PFun<T, ?> fn, String value) {
return this.andLike(fn, value, (l) -> {
l.left((String)null);
});
}
public <T> CndWrapper andNotLike(PFun<T, ?> fn, String value, Consumer<Like>... consumer) {
Like like = this.createLike(fn, value, false, consumer);
like.setNot(true);
super.and(like);
return this;
}
public <T> Like createLike(PFun<T, ?> fn, String value, boolean ignoreCase, Consumer<Like>... consumer) {
Like like = Exps.like(fn, value, ignoreCase);
if (Lang.isNotEmpty(consumer)) {
consumer[0].accept(like);
}
return like;
}
public <T> CndWrapper andBetween(PFun<T, ?> fn, Object value) {
super.and(fn, " between ", value);
return this;
}
public <T> CndWrapper andNotBetween(PFun<T, ?> fn, Object value) {
super.and(fn, " not between ", value);
return this;
}
public <T> CndWrapper andGreaterThan(PFun<T, ?> fn, long value) {
super.and(fn, " > ", value);
return this;
}
public <T> CndWrapper andGreaterThanOrEqualTo(PFun<T, ?> fn, long value) {
super.and(fn, ">= ", value);
return this;
}
public <T> CndWrapper andLessThan(PFun<T, ?> fn, long value) {
super.and(fn, " < ", value);
return this;
}
public <T> CndWrapper andLessThanOrEqualTo(PFun<T, ?> fn, long value) {
super.and(fn, " <= ", value);
return this;
}
public <T> CndWrapper desc(PFun<T, ?> fn) {
super.desc(fn);
return this;
}
public <T> CndWrapper asc(PFun<T, ?> fn) {
super.asc(fn);
return this;
}
public <T> CndWrapper findInSet(PFun<T, ?> fn, Object value) {
StringBuilder sb = new StringBuilder(100);
sb.append(" find_in_set(");
if (value instanceof String) {
value = "'".concat(value.toString()).concat("'");
}
sb.append(value.toString()).append(",").append(LambdaQuery.resolve(fn)).append(")");
super.and(new Static(sb.toString()));
return this;
}
public CndWrapper andDelFlag() {
this.andDelFlag(false);
return this;
}
public CndWrapper andDelFlag(boolean flag) {
super.and(BaseModel::getDelFlag, "=", flag);
return this;
}
public CndWrapper andDisabled() {
this.andDisabled(false);
return this;
}
public CndWrapper andDisabled(boolean disable) {
super.and("disabled", "=", disable);
return this;
}
}