From bc940795faa161a988a7df3f27072bb426f17fdb Mon Sep 17 00:00:00 2001
From: LHN <31457034@qq.com>
Date: 星期三, 19 十月 2022 16:34:09 +0800
Subject: [PATCH] changes

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java |   53 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
index 7fab106..5250602 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
@@ -10,6 +10,7 @@
 import com.sandu.ximon.admin.param.LEDProgramParam;
 import com.sandu.ximon.admin.security.SecurityUtils;
 import com.sandu.ximon.dao.domain.LEDProgram;
+import com.sandu.ximon.dao.enums.OrderByEnums;
 import com.sandu.ximon.dao.mapper.LEDProgramMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -34,6 +35,9 @@
         led.setPreview(receiveParam.getPreviewUrl());
         led.setWidth(receiveParam.getWidth());
         led.setHeight(receiveParam.getHeight());
+        if (receiveParam.getPages() == null) {
+            throw new BusinessException("鑺傜洰鍐呭涓㈠け");
+        }
         led.setPages(JSON.toJSONString(receiveParam.getPages()));
         return save(led);
     }
@@ -50,6 +54,9 @@
         led.setPreview(receiveParam.getPreviewUrl());
         led.setWidth(receiveParam.getWidth());
         led.setHeight(receiveParam.getHeight());
+        if (receiveParam.getPages() == null) {
+            throw new BusinessException("鑺傜洰鍐呭涓㈠け");
+        }
         led.setPages(JSON.toJSONString(receiveParam.getPages()));
         return updateById(led);
     }
@@ -80,14 +87,52 @@
         return param;
     }
 
-    public List<LEDProgram> listProgram(BaseConditionVO baseConditionVO, String keyword) {
+    public List<LEDProgram> listProgram(BaseConditionVO baseConditionVO, Integer order, Integer seq, String keyword) {
         LambdaQueryWrapper<LEDProgram> wrapper = listPrograms();
-        if (baseConditionVO != null) {
-            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
-        }
+
         if (keyword != null && !keyword.isEmpty()) {
             wrapper.like(LEDProgram::getName, keyword);
         }
+        //鎺掑簭瀛楁
+        String orderByResult = "id";
+        //姝e簭銆佸�掑彊
+        String orderBySeq = OrderByEnums.ASC.getCode();
+        if (order != null) {
+            switch (order) {
+                case 1:
+                    orderByResult = OrderByEnums.LED_N_PROGRAM_CREATE_TIME.getCode();
+                    break;
+                default:
+            }
+        }
+        if (seq != null) {
+            switch (seq) {
+                case 1:
+                    orderBySeq = OrderByEnums.ASC.getCode();
+                    break;
+                case 2:
+                    orderBySeq = OrderByEnums.DESC.getCode();
+                    break;
+                default:
+                    break;
+            }
+        }
+        //鎺掑簭鏂瑰紡
+        String orderBy = orderByResult + " " + orderBySeq;
+
+        if (baseConditionVO != null) {
+            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
+        }
+        return list(wrapper);
+    }
+
+    public List<LEDProgram> listProgramOnBinding(String keyword) {
+        LambdaQueryWrapper<LEDProgram> wrapper = listPrograms();
+
+        if (keyword != null && !keyword.isEmpty()) {
+            wrapper.like(LEDProgram::getName, keyword);
+        }
+
         return list(wrapper);
     }
 

--
Gitblit v1.9.3