All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gitee.mingbaobaba.apijson.querycondition.query.conditions.ApiJsonQueryLambdaWrapper Maven / Gradle / Ivy

There is a newer version: v1.1.0
Show newest version
package io.gitee.mingbaobaba.apijson.querycondition.query.conditions;


/**
 * 

基于Lambda构建查询参数

* * @author yingsheng.ye * @version 1.0.0 * @since 2023/6/19 18:06 */ public class ApiJsonQueryLambdaWrapper extends AbstractQueryWrapper, ApiJsonQueryLambdaWrapper> implements ApiJsonQuery { @SafeVarargs @Override public final ApiJsonQueryLambdaWrapper select(ColumnUtil.SFunction... columns) { return select(true,columns); } @SafeVarargs @Override public final ApiJsonQueryLambdaWrapper select(boolean condition, ColumnUtil.SFunction... columns) { if(condition) { for (ColumnUtil.SFunction column : columns) { columnList.add(ColumnUtil.getName(column)); } } return typedThis; } @Override protected ApiJsonQueryLambdaWrapper addCondition(boolean condition, ColumnUtil.SFunction column, EnumKeyword keyword, Object val) { if (condition) { this.conditionHandle(new Condition(parseName(column), keyword, val)); } return typedThis; } @Override protected ApiJsonQueryLambdaWrapper addAggFunc(boolean condition, ColumnUtil.SFunction column, EnumKeyword keyword, Object val) { if (condition) { this.aggFuncHandle(keyword, parseName(column), val); } return typedThis; } @Override protected ApiJsonQueryLambdaWrapper addGroupFunc(boolean condition, ColumnUtil.SFunction column, EnumKeyword keyword) { if (condition) { this.groupFuncHandle(keyword,parseName(column)); } return typedThis; } @Override protected ApiJsonQueryLambdaWrapper addOrderByFunc(boolean condition, ColumnUtil.SFunction column, EnumKeyword keyword, String s) { if (condition) { this.orderByFuncHandle(keyword,parseName(column) + s); } return typedThis; } @Override protected ApiJsonQueryLambdaWrapper instance() { return new ApiJsonQueryLambdaWrapper<>(); } private String parseName(ColumnUtil.SFunction column) { return null == column ? null : ColumnUtil.getName(column); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy