mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-01 18:57:16 +08:00
优化:基于阿里巴巴 Java 开发手册(黄山版)优化常量
1.编程规约>常量定义>第1条: 【强制】不允许任何魔法值(即未经预先定义的常量)直接出现在代码中。
This commit is contained in:
@@ -30,7 +30,7 @@ import org.springframework.data.domain.Sort;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.constant.CharConsts;
|
||||
import top.charles7c.cnadmin.common.constant.StringConsts;
|
||||
|
||||
/**
|
||||
* 排序查询条件
|
||||
@@ -62,10 +62,10 @@ public class SortQuery implements Serializable {
|
||||
}
|
||||
|
||||
List<Sort.Order> orders = new ArrayList<>(sort.length);
|
||||
if (StrUtil.contains(sort[0], CharConsts.COMMA)) {
|
||||
if (StrUtil.contains(sort[0], StringConsts.COMMA)) {
|
||||
// e.g "sort=published,desc&sort=title,asc"
|
||||
for (String s : sort) {
|
||||
List<String> sortList = StrUtil.splitTrim(s, CharConsts.COMMA);
|
||||
List<String> sortList = StrUtil.splitTrim(s, StringConsts.COMMA);
|
||||
Sort.Order order =
|
||||
new Sort.Order(Sort.Direction.valueOf(sortList.get(1).toUpperCase()), sortList.get(0));
|
||||
orders.add(order);
|
||||
|
||||
Reference in New Issue
Block a user