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.
com.github.wz2cool.dynamic.mybatis.mapper.SelectMaxByGroupedQueryMapper Maven / Gradle / Ivy
package com.github.wz2cool.dynamic.mybatis.mapper;
import com.github.wz2cool.dynamic.GroupedQuery;
import com.github.wz2cool.dynamic.helper.CommonsHelper;
import com.github.wz2cool.dynamic.lambda.*;
import com.github.wz2cool.dynamic.mybatis.QueryHelper;
import com.github.wz2cool.dynamic.mybatis.TypeHelper;
import com.github.wz2cool.dynamic.mybatis.mapper.constant.MapperConstants;
import com.github.wz2cool.dynamic.mybatis.mapper.provider.GroupedQueryProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.session.RowBounds;
import tk.mybatis.mapper.annotation.RegisterMapper;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/**
* @author Frank
**/
@RegisterMapper
@SuppressWarnings("java:S119")
public interface SelectMaxByGroupedQueryMapper {
QueryHelper QUERY_HELPER = new QueryHelper();
/**
* Select max value of column by dynamic query.
*
* @param column the column need get max value
* @param groupedQuery grouped query
* @return max value of column.
*/
@SelectProvider(type = GroupedQueryProvider.class, method = "dynamicSQL")
List selectMaxByGroupedQuery(
@Param(MapperConstants.COLUMN) String column,
@Param(MapperConstants.GROUPED_QUERY) GroupedQuery groupedQuery);
/**
* Select max value of column by dynamic query.
*
* @param column the column need get max value
* @param groupedQuery grouped query
* @return max value of column.
*/
@SelectProvider(type = GroupedQueryProvider.class, method = "dynamicSQL")
List selectMaxRowBoundsByGroupedQuery(
@Param(MapperConstants.COLUMN) String column,
@Param(MapperConstants.GROUPED_QUERY) GroupedQuery groupedQuery,
RowBounds rowBounds);
default List selectMaxByGroupedQueryInternal(
GetPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
String propertyName = CommonsHelper.getPropertyName(getPropertyFunction);
Class queryClass = groupedQuery.getQueryClass();
String queryColumn = QUERY_HELPER.getQueryColumnByProperty(queryClass, propertyName);
return selectMaxByGroupedQuery(queryColumn, groupedQuery);
}
default List selectMaxByGroupedQueryInternal(
GetPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
String propertyName = CommonsHelper.getPropertyName(getPropertyFunction);
Class queryClass = groupedQuery.getQueryClass();
String queryColumn = QUERY_HELPER.getQueryColumnByProperty(queryClass, propertyName);
return selectMaxRowBoundsByGroupedQuery(queryColumn, groupedQuery, rowBounds);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetBigDecimalPropertyFunction getPropertyFunction,
GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getBigDecimal(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetBytePropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getByte(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetBytePropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetDatePropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getDate(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetDatePropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetDoublePropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getDouble(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetDoublePropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetFloatPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getFloat(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetFloatPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetIntegerPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getInteger(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetIntegerPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetLongPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getLong(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetLongPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @param rowBounds row bonds
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetShortPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getShort(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetShortPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetStringPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMaxByGroupedQueryInternal(getPropertyFunction, groupedQuery, rowBounds);
List result = new ArrayList<>();
if (objects.isEmpty()) {
return result;
}
for (Object object : objects) {
Optional.ofNullable(TypeHelper.getString(object))
.ifPresent(result::add);
}
return result;
}
/**
* Select max value of property by dynamic query.
*
* @param getPropertyFunction the property need get max value
* @param groupedQuery grouped query.
* @return max value of property.
*/
default List selectMaxByGroupedQuery(
GetStringPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMaxByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
}