From ec63fb17c5ba3e5b2a5a4106c25b4e249a2f980f Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 22 十一月 2022 18:44:51 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java | 45 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
index 7aa4294..3090329 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
@@ -18,9 +18,11 @@
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.dao.bo.LightReportDataBo;
+import com.sandu.ximon.dao.domain.Light;
import com.sandu.ximon.dao.domain.LightReportData;
import com.sandu.ximon.dao.domain.Pole;
import com.sandu.ximon.dao.domain.PoleBinding;
+import com.sandu.ximon.dao.enums.OrderByEnums;
import com.sandu.ximon.dao.mapper.LightReportDataMapper;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
@@ -94,11 +96,36 @@
* @param keyword 鍏抽敭璇�
* @param deviceCode 璁惧鐮�
*/
- public CommonPage listReportData(int pageNo, int pageSize, String keyword, String deviceCode) {
+ public CommonPage listReportData(int pageNo, int pageSize, String keyword, String deviceCode, Integer order, Integer seq) {
List<LightReportDataBo> lightReportDataBos = new ArrayList<>(pageSize);
-
- CommonPage<String> stringCommonPage = SpringContextHolder.getBean(LightService.class).listDeviceCode(pageNo, pageSize, keyword, deviceCode);
+ //鎺掑簭瀛楁
+ String orderByResult = "t1.create_time";
+ //姝e簭銆佸�掑彊
+ String orderBySeq = OrderByEnums.ASC.getCode();
+ if (order != null) {
+ switch (order) {
+ case 1:
+ orderByResult = OrderByEnums.LIGHT_DATA_CREATE_TIME.getCode();
+ break;
+ default:
+ }
+ }
+ if (seq != null) {
+ switch (seq) {
+ case 1:
+ orderBySeq = " ASC";
+ break;
+ case 2:
+ orderBySeq = " DESC";
+ break;
+ default:
+ break;
+ }
+ }
+ //鎺掑簭鏂瑰紡
+ String orderBy = orderByResult + " " + orderBySeq;
+ CommonPage<String> stringCommonPage = SpringContextHolder.getBean(LightService.class).listDeviceCode(pageNo, pageSize, keyword, deviceCode, orderBy);
List<String> macList = stringCommonPage.getList();
if (CollUtil.isEmpty(macList)) {
return new CommonPage();
@@ -215,8 +242,20 @@
if (macCode.isEmpty()) {
throw new BusinessException("mac涓嶈兘涓虹┖");
}
+
+ Light light = SpringContextHolder.getBean(LightService.class)
+ .getOne(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, macCode));
+ if (light == null) {
+ throw new BusinessException("绯荤粺涓笉瀛樺湪璇ュ崟鐏�");
+ }
PageHelper.startPage(conditionVO.getPageNo(), conditionVO.getPageSize());
List<LightReportData> list = list(Wrappers.lambdaQuery(LightReportData.class).eq(LightReportData::getDeviceCode, macCode));
+ list.forEach(
+ lightReportData -> {
+ lightReportData.setCreateTime(lightReportData.getCreateTime1().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ lightReportData.setUpdateTime(lightReportData.getUpdateTime1().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ }
+ );
return list;
}
}
--
Gitblit v1.9.3