|
|
@@ -250,8 +250,7 @@ public class MongoService<T>{
|
|
|
private Query processOrderby(Query query, String orderBy){
|
|
|
if(!TextUtils.isEmpty(orderBy)){
|
|
|
String[] orderbyList = orderBy.split(",");
|
|
|
- for (String orderbyItem:orderbyList
|
|
|
- ) {
|
|
|
+ for (String orderbyItem:orderbyList) {
|
|
|
if(!TextUtils.isEmpty(orderbyItem)){
|
|
|
if(orderbyItem.contains(" ")){
|
|
|
|
|
|
@@ -365,7 +364,11 @@ public class MongoService<T>{
|
|
|
// 排序
|
|
|
String field = queryRequest.getOrderByColumn();
|
|
|
if (!StringUtils.isEmpty(field)) {
|
|
|
- query.with(Sort.by(getOrder(queryRequest)));
|
|
|
+ if(field.split(",").length>1){
|
|
|
+ query = processOrderby(query,field);
|
|
|
+ }else{
|
|
|
+ query.with(Sort.by(getOrder(queryRequest)));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//设置总数
|
|
|
@@ -480,6 +483,9 @@ public class MongoService<T>{
|
|
|
criteria.and(key.split("_")[1]).lte(value);
|
|
|
} else if (key.startsWith("array")) {
|
|
|
criteria.and(key.split("_")[1]).in(value);
|
|
|
+ } else if (key.startsWith("timeStr")) {//字段类型是int或string的
|
|
|
+ String[] split = value.toString().split(",");//时间戳(秒)
|
|
|
+ criteria.and(key.split("_")[1]).gte(split[0]).lte(split[1]);
|
|
|
} else if (key.startsWith("time")) {//字段类型是int或string的
|
|
|
String[] split = value.toString().split(",");//时间戳(秒)
|
|
|
if (split[0].matches("^-?\\d+$") && split[1].matches("^-?\\d+$")) {
|