From 5e2fe6ce6e80dea99f6eda304dba6fafbb30ad63 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 09 九月 2022 11:34:13 +0800
Subject: [PATCH] 灯杆解绑fix

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java |   61 +++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 2 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 ee80711..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
@@ -3,16 +3,18 @@
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.PageHelper;
 import com.sandu.common.execption.BusinessException;
+import com.sandu.common.object.BaseConditionVO;
 import com.sandu.common.service.impl.BaseServiceImpl;
 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;
 
-import java.time.LocalDateTime;
 import java.util.List;
 
 @Service
@@ -33,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);
     }
@@ -49,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);
     }
@@ -79,8 +87,57 @@
         return param;
     }
 
+    public List<LEDProgram> listProgram(BaseConditionVO baseConditionVO, Integer order, Integer seq, String keyword) {
+        LambdaQueryWrapper<LEDProgram> wrapper = listPrograms();
 
-    public LambdaQueryWrapper<LEDProgram> listProgram() {
+        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);
+    }
+
+
+    public LambdaQueryWrapper<LEDProgram> listPrograms() {
         if (SecurityUtils.getClientId() == null) {
             return Wrappers.lambdaQuery(LEDProgram.class);
         } else {

--
Gitblit v1.9.3