From 66080a0b82181aaa567e8080ee2b82315b840930 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期一, 18 四月 2022 14:30:59 +0800
Subject: [PATCH] 节目列表

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java      |   26 ++++++++
 dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java                         |   20 ++++--
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java      |   31 +---------
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java       |   15 ++--
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java |   48 ++++++++--------
 dao/src/main/resources/mapper/LEDProgramMapper.xml                                   |   23 ++++---
 6 files changed, 87 insertions(+), 76 deletions(-)

diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java b/dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java
index 9d9a719..2d17f00 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java
@@ -4,30 +4,38 @@
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+
 import java.io.Serializable;
 import java.time.LocalDateTime;
+
 import lombok.Data;
 
 /**
  * LED鑺傜洰琛�
+ *
  * @TableName led_program
  */
-@TableName(value ="led_program")
+@TableName(value = "led_program")
 @Data
 public class LEDProgram implements Serializable {
     /**
-     * 
+     *
      */
     @TableId(type = IdType.AUTO)
     private Long id;
 
     /**
-     * 
+     *
      */
     private Long userId;
 
     /**
-     * 
+     *
+     */
+    private Long clientId;
+
+    /**
+     *
      */
     private String userName;
 
@@ -62,12 +70,12 @@
     private Integer kind;
 
     /**
-     * 
+     *
      */
     private LocalDateTime createTime;
 
     /**
-     * 
+     *
      */
     private LocalDateTime updateTime;
 
diff --git a/dao/src/main/resources/mapper/LEDProgramMapper.xml b/dao/src/main/resources/mapper/LEDProgramMapper.xml
index d32a451..395b6c0 100644
--- a/dao/src/main/resources/mapper/LEDProgramMapper.xml
+++ b/dao/src/main/resources/mapper/LEDProgramMapper.xml
@@ -5,17 +5,18 @@
 <mapper namespace="com.sandu.ximon.dao.mapper.LEDProgramMapper">
 
     <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LEDProgram">
-            <id property="id" column="id" jdbcType="BIGINT"/>
-            <result property="userId" column="user_id" jdbcType="BIGINT"/>
-            <result property="userName" column="user_name" jdbcType="VARCHAR"/>
-            <result property="name" column="name" jdbcType="VARCHAR"/>
-            <result property="preview" column="preview" jdbcType="VARCHAR"/>
-            <result property="width" column="width" jdbcType="INTEGER"/>
-            <result property="height" column="height" jdbcType="INTEGER"/>
-            <result property="pages" column="pages" jdbcType="VARCHAR"/>
-            <result property="kind" column="kind" jdbcType="INTEGER"/>
-            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <id property="id" column="id" jdbcType="BIGINT"/>
+        <result property="userId" column="user_id" jdbcType="BIGINT"/>
+        <result property="clientId" column="client_id" jdbcType="BIGINT"/>
+        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="preview" column="preview" jdbcType="VARCHAR"/>
+        <result property="width" column="width" jdbcType="INTEGER"/>
+        <result property="height" column="height" jdbcType="INTEGER"/>
+        <result property="pages" column="pages" jdbcType="VARCHAR"/>
+        <result property="kind" column="kind" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <sql id="Base_Column_List">
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java
index 51eaaec..39d1d3e 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java
@@ -54,35 +54,35 @@
         }
         PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
         LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram();
-        if (null != keyword) {
+        if (!keyword.isEmpty()) {
             wrapper.like(LEDProgram::getName, keyword);
         }
         return ResponseUtil.successPage(ledProgramService.list(wrapper));
 
     }
 
-    /**
-     * 妯$硦鏌ヨ
-     *
-     * @return
-     */
-    @GetMapping("/listLike")
-    public ResponseVO<Object> listLikeProgram(@RequestBody ReceiveParam receiveParam) {
-        LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram();
-        if (receiveParam.getKind() != null || receiveParam.getName() != null) {
-
-            wrapper.like(LEDProgram::getName, receiveParam.getName())
-                    .or(
-                            ledProgramLambdaQueryWrapper -> {
-                                ledProgramLambdaQueryWrapper.like(LEDProgram::getKind, receiveParam.getKind());
-                            }
-                    );
-
-        }
-
-        // List<LEDProgram> list = ledProgramService.list(wrapper);
-        return ResponseUtil.success(ledProgramService.list(wrapper));
-
-    }
+//    /**
+//     * 妯$硦鏌ヨ
+//     *
+//     * @return
+//     */
+//    @GetMapping("/listLike")
+//    public ResponseVO<Object> listLikeProgram(@RequestBody ReceiveParam receiveParam) {
+//        LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram();
+//        if (receiveParam.getKind() != null || receiveParam.getName() != null) {
+//
+//            wrapper.like(LEDProgram::getName, receiveParam.getName())
+//                    .or(
+//                            ledProgramLambdaQueryWrapper -> {
+//                                ledProgramLambdaQueryWrapper.like(LEDProgram::getKind, receiveParam.getKind());
+//                            }
+//                    );
+//
+//        }
+//
+//        // List<LEDProgram> list = ledProgramService.list(wrapper);
+//        return ResponseUtil.success(ledProgramService.list(wrapper));
+//
+//    }
 
 }
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 db591c3..e04c73a 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
@@ -115,31 +115,10 @@
         if (!permissionConfig.check(MenuEnum.LED_PROGRAM_LIST.getCode())) {
             return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
         }
+        LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = xiXunPlayerService.XixunPlayerList(keyword);
         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())) {
-
-            return ResponseUtil.success(xiXunPlayerService.list(wrapper)); //  todo
-        } else {
-            return ResponseUtil.success(xiXunPlayerService.list(wrapper));
-        }
+        return ResponseUtil.success(xiXunPlayerService.list(wrapper));
     }
 
 
@@ -303,13 +282,11 @@
     }
 
     /**
-     *
-     *
      * @param
      * @return
      */
     @GetMapping("/getbycode")
-  public ResponseVO<Object> getLedByLightControlCode(String lightemitControlCode) {
+    public ResponseVO<Object> getLedByLightControlCode(String lightemitControlCode) {
         return ResponseUtil.success(poleLightemitService.getLedByLightControlCode(lightemitControlCode));
     }
 
@@ -471,8 +448,6 @@
         scheduleService.ledschedulepush(id, lightemitIds);
         return ResponseUtil.success("璁剧疆鎴愬姛");
     }
-
-
 
 
 }
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 a03e5d8..e8116b9 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
@@ -19,7 +19,6 @@
 public class LEDProgramService extends BaseServiceImpl<LEDProgramMapper, LEDProgram> {
 
 
-
     public boolean addProgram(LEDProgramParam receiveParam) {
 
         LEDProgram led = new LEDProgram();
@@ -36,7 +35,7 @@
     }
 
 
-    public boolean updateProgram(Long pid,LEDProgramParam receiveParam) {
+    public boolean updateProgram(Long pid, LEDProgramParam receiveParam) {
 
         LEDProgram byId = getById(pid);
         if (byId == null) {
@@ -70,7 +69,7 @@
         if (byId == null) {
             throw new BusinessException("鏈壘鍒拌鑺傜洰");
         }
-        LEDProgramParam param=new LEDProgramParam();
+        LEDProgramParam param = new LEDProgramParam();
         param.setId(byId.getId());
         param.setHeight(byId.getHeight());
         param.setWidth(byId.getWidth());
@@ -82,11 +81,13 @@
 
 
     public LambdaQueryWrapper<LEDProgram> listProgram() {
-        if (SecurityUtils.getClientId() != null) {
-            return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getClientId());
-        } else {
+        if (SecurityUtils.getClientId() == null) {
             return Wrappers.lambdaQuery(LEDProgram.class);
+        } else {
+            return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getUserId())
+                    .or(w -> {
+                        w.eq(LEDProgram::getClientId, SecurityUtils.getClientId());
+                    });
         }
     }
-
 }
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
index 6adbc76..a26a427 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
@@ -1,6 +1,8 @@
 package com.sandu.ximon.admin.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.sandu.common.execption.BusinessException;
@@ -12,6 +14,7 @@
 import com.sandu.ximon.admin.utils.JsonUtil;
 import com.sandu.ximon.admin.utils.LightemitUtils;
 import com.sandu.ximon.admin.utils.LogUtils;
+import com.sandu.ximon.dao.domain.LEDProgram;
 import com.sandu.ximon.dao.domain.LedSFile;
 import com.sandu.ximon.dao.domain.PoleLightemitEntity;
 import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
@@ -39,6 +42,29 @@
     private final ClientService clientService;
     private final LedSFileService xiXunFileService;
 
+    //鐔欒鑺傜洰鍒楄〃
+    public LambdaQueryWrapper<PoleXixunPlayerEntity> XixunPlayerList(String keyword) {
+        if (SecurityUtils.getClientId() == null) {
+            if (keyword.isEmpty()) {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class);
+            } else {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
+            }
+
+        } else {
+            if (keyword.isEmpty()) {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).eq(PoleXixunPlayerEntity::getCreateUserId, SecurityUtils.getUserId())
+                        .or(w -> {
+                            w.eq(PoleXixunPlayerEntity::getClientId, SecurityUtils.getClientId());
+                        });
+            } else {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).eq(PoleXixunPlayerEntity::getCreateUserId, SecurityUtils.getUserId())
+                        .or(w -> {
+                            w.eq(PoleXixunPlayerEntity::getClientId, SecurityUtils.getClientId());
+                        }).like(PoleXixunPlayerEntity::getProgramName, keyword);
+            }
+        }
+    }
 
     public boolean insert(ProgramPro programPro) {
         String json = JsonUtil.jsonObj2Sting(programPro);

--
Gitblit v1.9.3