|
|
@@ -2,10 +2,13 @@ package com.zhongshu.iot.server.core.dao.base;
|
|
|
|
|
|
import com.zhongshu.iot.client.model.baseParam.SuperSearchParam;
|
|
|
import com.zhongshu.iot.server.core.util.CommonUtil;
|
|
|
+import com.zhongshu.iot.server.core.util.DateUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @author TRX
|
|
|
* @date 2024/5/31
|
|
|
@@ -28,6 +31,20 @@ public abstract class BaseImpl {
|
|
|
Criteria criteria = new Criteria();
|
|
|
criteria.and("isDelete").ne(Boolean.TRUE);
|
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getTimes()) && param.getTimes().size() == 2) {
|
|
|
+ List<Long> times = param.getTimes();
|
|
|
+ param.setStartTime(times.get(0));
|
|
|
+ param.setEndTime(times.get(1));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CommonUtil.longIsEmpty(param.getStartTime())) {
|
|
|
+ param.setStartTime(DateUtils.getDayStartTime(param.getStartTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CommonUtil.longIsEmpty(param.getEndTime())) {
|
|
|
+ param.setEndTime(DateUtils.getDayEndTime(param.getEndTime()));
|
|
|
+ }
|
|
|
+
|
|
|
if (!CommonUtil.longIsEmpty(param.getStartTime()) && !CommonUtil.longIsEmpty(param.getEndTime())) {
|
|
|
criteria.and("createTime").gte(param.getStartTime()).lte(param.getEndTime());
|
|
|
} else if (!CommonUtil.longIsEmpty(param.getStartTime()) && CommonUtil.longIsEmpty(param.getEndTime())) {
|