From 6881da4400dba323d6e11a810de0571a7453cfd7 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期五, 25 二月 2022 15:03:18 +0800
Subject: [PATCH] 功能完善

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java |   63 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
index 9fab077..5cf223e 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -1,5 +1,6 @@
 package com.sandu.ximon.admin.controller;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -15,6 +16,7 @@
 import com.sandu.ximon.admin.service.PoleLightemitService;
 import com.sandu.ximon.admin.service.XiXunPlayerService;
 import com.sandu.ximon.dao.domain.LedPlayerEntity;
+import com.sandu.ximon.dao.domain.PlayPlanNv;
 import com.sandu.ximon.dao.domain.PoleLightemitEntity;
 import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
 import com.sandu.ximon.dao.enums.AdministratorEnums;
@@ -57,10 +59,24 @@
         PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
 
         LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
+//        if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){
+//            boolean clientId = clientService.findClientId();
+//            if(clientId){
+//                wrapper= wrapper.eq(PoleXixunPlayerEntity::getUserId,SecurityUtils.getUserId());
+//            }
+//            wrapper= wrapper.eq(PoleXixunPlayerEntity::getClientId,clientService.getClientId());
+//        }
+//        wrapper=Wrappers.lambdaQuery(PoleXixunPlayerEntity.class);
+//        if(StrUtil.isNotBlank(keyword)){
+//            wrapper.like(PoleXixunPlayerEntity::getLightemitName,keyword).or(
+//                    lambdaQueryWrapper -> {
+//                        lambdaQueryWrapper.like(PoleXixunPlayerEntity::getLightemitControlCode, keyword);
+//                    }
+//            );
+//        }
+//        return ResponseUtil.success(poleLightemitService.list(wrapper));
         if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
-//            clientService.findClientId()
-//            wrapper.eq(PoleXixunPlayerEntity::getCreateUserId,)
-            //wrapper.eq(LedPlayerEntity::get)
+
             return ResponseUtil.success(xiXunPlayerService.list(wrapper)); //  todo
         }else {
             return ResponseUtil.success(xiXunPlayerService.list(wrapper));
@@ -85,7 +101,46 @@
 
         poleLightemitService.savePoleLightemit(poleLightemit);
 
-        return ResponseUtil.success("");
+
+        return ResponseUtil.success("鏂板鎴愬姛");
     }
 
+    @PostMapping("/updateLed/{ledId}")
+    public ResponseVO<Object> updatePoleLightemit(@PathVariable Long ledId,@RequestBody PoleLightemitEntity poleLightemit){
+        poleLightemitService.updatePoleLightemit(ledId,poleLightemit);
+        return ResponseUtil.success("淇敼鎴愬姛");
+    }
+
+    @PostMapping("/deleteLed")
+    public ResponseVO<Object> deleteLed(@RequestBody List<Long> ledIds){
+        boolean b = poleLightemitService.deletePoleLightemit(ledIds);
+        if(b){
+            return ResponseUtil.success("鍒犻櫎鎴愬姛");
+        }else {
+            return ResponseUtil.success("鍒犻櫎澶辫触");
+        }
+    }
+
+
+    @GetMapping("/listLed")
+    public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
+        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+        LambdaQueryWrapper<PoleLightemitEntity> wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
+        if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){
+            boolean clientId = clientService.findClientId();
+            if(clientId){
+                wrapper= wrapper.eq(PoleLightemitEntity::getUserId,SecurityUtils.getUserId());
+            }
+            wrapper= wrapper.eq(PoleLightemitEntity::getClientId,clientService.getClientId());
+        }
+        wrapper=Wrappers.lambdaQuery(PoleLightemitEntity.class);
+        if(StrUtil.isNotBlank(keyword)){
+            wrapper.like(PoleLightemitEntity::getLightemitName,keyword).or(
+                    lambdaQueryWrapper -> {
+                        lambdaQueryWrapper.like(PoleLightemitEntity::getLightemitControlCode, keyword);
+                    }
+            );
+        }
+        return ResponseUtil.success(poleLightemitService.list(wrapper));
+    }
 }

--
Gitblit v1.9.3