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.SelectMinByGroupedQueryMapper 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 SelectMinByGroupedQueryMapper {
QueryHelper QUERY_HELPER = new QueryHelper();
/**
* Select Min value of column by dynamic query.
*
* @param column the column need get Min value
* @param groupedQuery grouped query
* @return Min value of column.
*/
@SelectProvider(type = GroupedQueryProvider.class, method = "dynamicSQL")
List selectMinByGroupedQuery(
@Param(MapperConstants.COLUMN) String column,
@Param(MapperConstants.GROUPED_QUERY) GroupedQuery groupedQuery);
/**
* Select Min value of column by dynamic query.
*
* @param column the column need get Min value
* @param groupedQuery grouped query
* @return Min value of column.
*/
@SelectProvider(type = GroupedQueryProvider.class, method = "dynamicSQL")
List selectMinRowBoundsByGroupedQuery(
@Param(MapperConstants.COLUMN) String column,
@Param(MapperConstants.GROUPED_QUERY) GroupedQuery groupedQuery,
RowBounds rowBounds);
default List selectMinByGroupedQueryInternal(
GetPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
String propertyName = CommonsHelper.getPropertyName(getPropertyFunction);
Class queryClass = groupedQuery.getQueryClass();
String queryColumn = QUERY_HELPER.getQueryColumnByProperty(queryClass, propertyName);
return selectMinByGroupedQuery(queryColumn, groupedQuery);
}
default List selectMinByGroupedQueryInternal(
GetPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
String propertyName = CommonsHelper.getPropertyName(getPropertyFunction);
Class queryClass = groupedQuery.getQueryClass();
String queryColumn = QUERY_HELPER.getQueryColumnByProperty(queryClass, propertyName);
return selectMinRowBoundsByGroupedQuery(queryColumn, groupedQuery, rowBounds);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetBigDecimalPropertyFunction getPropertyFunction,
GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetBytePropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetBytePropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetDatePropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetDatePropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetDoublePropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetDoublePropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetFloatPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetFloatPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetIntegerPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetIntegerPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetLongPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetLongPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @param rowBounds row bonds
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetShortPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetShortPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
/**
* Select Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @param rowBounds row bounds
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetStringPropertyFunction getPropertyFunction, GroupedQuery groupedQuery,
RowBounds rowBounds) {
List objects = rowBounds == null ?
selectMinByGroupedQueryInternal(getPropertyFunction, groupedQuery) :
selectMinByGroupedQueryInternal(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 Min value of property by dynamic query.
*
* @param getPropertyFunction the property need get Min value
* @param groupedQuery grouped query.
* @return Min value of property.
*/
default List selectMinByGroupedQuery(
GetStringPropertyFunction getPropertyFunction, GroupedQuery groupedQuery) {
return selectMinByGroupedQuery(getPropertyFunction, groupedQuery, null);
}
}