!1108【代码优化】排序:字段驼峰改为下划线
This commit is contained in:
parent
7fbdf24bca
commit
cf1b41741e
|
@ -36,8 +36,9 @@ public class MyBatisUtils {
|
||||||
Page<T> page = new Page<>(pageParam.getPageNo(), pageParam.getPageSize());
|
Page<T> page = new Page<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||||
// 排序字段
|
// 排序字段
|
||||||
if (!CollectionUtil.isEmpty(sortingFields)) {
|
if (!CollectionUtil.isEmpty(sortingFields)) {
|
||||||
page.addOrder(sortingFields.stream().map(sortingField -> SortingField.ORDER_ASC.equals(sortingField.getOrder()) ?
|
page.addOrder(sortingFields.stream().map(sortingField -> SortingField.ORDER_ASC.equals(sortingField.getOrder())
|
||||||
OrderItem.asc(sortingField.getField()) : OrderItem.desc(sortingField.getField()))
|
? OrderItem.asc(StrUtil.toUnderlineCase(sortingField.getField()))
|
||||||
|
: OrderItem.desc(StrUtil.toUnderlineCase(sortingField.getField())))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
|
|
Loading…
Reference in New Issue