mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 04:59:21 +08:00
feat(data/mp): QueryWrapperHelper 新增 sort 方法
This commit is contained in:
@@ -55,6 +55,23 @@ public class QueryWrapperHelper {
|
||||
private QueryWrapperHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置排序
|
||||
*
|
||||
* @param queryWrapper 查询条件封装对象
|
||||
* @param sort 排序条件
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public static <T> void sort(QueryWrapper<T> queryWrapper, Sort sort) {
|
||||
if (sort == null || sort.isUnsorted()) {
|
||||
return;
|
||||
}
|
||||
for (Sort.Order order : sort) {
|
||||
String property = order.getProperty();
|
||||
queryWrapper.orderBy(true, order.isAscending(), CharSequenceUtil.toUnderlineCase(property));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 QueryWrapper
|
||||
*
|
||||
|
Reference in New Issue
Block a user