Commit 21088b65 authored by tangwei's avatar tangwei

增加排序

parent de251e81
......@@ -24,4 +24,9 @@ public class RedisKey {
public static final String THOUGHT_ID="thought_id";
//根据警情id查询警情详情记录
public static final String ALERTCALLED_ID="alertcalled_id";
/** 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)}) */
public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase();
}
}
......@@ -224,7 +224,6 @@ public class AlertCalledController extends BaseController {
public ResponseModel<List<AlertCalled>> list(AlertCalled alertCalled) {
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
setQueryWrapper(alertCalledQueryWrapper, alertCalled,null);
List<AlertCalled> list = iAlertCalledService.list(alertCalledQueryWrapper);
return ResponseHelper.buildResponse(list);
}
......@@ -232,14 +231,16 @@ public class AlertCalledController extends BaseController {
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
Class<? extends AlertCalled> aClass = alertCalled.getClass();
queryWrapper.eq("is_delete", 0);
queryWrapper.orderByDesc("call_time");
if(sort!=null) {
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
queryWrapper.orderByAsc(date[0]);
}else {
queryWrapper.orderByDesc(date[0]);
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
}else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
}
}else {
queryWrapper.orderByDesc("call_time");
}
if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment