From 4e53338c0c6859a43693f3f690f0c05da888a02e Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 12 八月 2022 11:48:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java |   79 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
index e99a694..3c19b5d 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
@@ -11,6 +11,7 @@
 import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
 import com.sandu.ximon.admin.vo.EquipmentInfomation;
 import com.sandu.ximon.dao.domain.LedPlayerEntity;
+import com.sandu.ximon.dao.enums.OrderByEnums;
 import com.sandu.ximon.dao.mapper.LedPlayerEntityMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -117,9 +118,49 @@
     }
 
 
-    public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword) {
+    /**
+     * 璇虹摝鍒楄〃
+     *
+     * @param baseConditionVO
+     * @param keyword
+     * @param order
+     * @param seq
+     * @return
+     */
+    public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) {
+        //鎺掑簭瀛楁
+        String orderByResult = OrderByEnums.VNNOX_ID.getCode();
+        //姝e簭銆佸�掑彊
+        String orderBySeq = OrderByEnums.ASC.getCode();
+        if (order != null) {
+            switch (order) {
+                case 1:
+                    orderByResult = OrderByEnums.VNNOX_POLE_NAME.getCode();
+                    break;
+                case 2:
+                    orderByResult = OrderByEnums.VNNOX_CREATE_TIMESTAMP.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());
+            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
         }
         List<LedPlayerEntity> list;
         //瓒呯
@@ -131,4 +172,38 @@
         return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
     }
 
+    /**
+     * 璇虹摝鍒楄〃锛堢敤浜庨椤垫暟鎹粺璁★級
+     *
+     * @return
+     */
+    public List<LedPlayerEntity> ledPlayerEntityListOnHome() {
+        List<LedPlayerEntity> list;
+        //瓒呯
+        if (SecurityUtils.getClientId() == null) {
+            list = ledPlayerEntityMapper.ledPlayerEntityList(null, null);
+        } else {
+            list = ledPlayerEntityMapper.ledPlayerEntityList(null, SecurityUtils.getUserId());
+        }
+        return list == null ? new ArrayList<>() : list;
+    }
+
+    /**
+     * 璇虹摝鍒楄〃锛堢敤浜庣粦瀹氾級
+     *
+     * @param keyword
+     * @return
+     */
+    public List<LedPlayerEntity> ledPlayerEntityListOnBinding(String keyword) {
+
+        List<LedPlayerEntity> list;
+        //瓒呯
+        if (SecurityUtils.getClientId() == null) {
+            list = ledPlayerEntityMapper.ledPlayerEntityListOnBinding(keyword, null);
+        } else {
+            list = ledPlayerEntityMapper.ledPlayerEntityListOnBinding(keyword, SecurityUtils.getUserId());
+        }
+        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
+    }
+
 }

--
Gitblit v1.9.3