From 3042d3d2afae0828d851f820c3bbcffa352fd61f Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 07 十一月 2022 17:41:59 +0800
Subject: [PATCH] 音柱、手持设备修改

---
 ycl-platform/src/main/java/com/ycl/controller/epuipment/HandheldTerminalController.java |   10 ++++++++--
 ycl-platform/src/main/java/com/ycl/service/equipment/impl/LoudspeakerServiceImpl.java   |    4 +++-
 ycl-platform/src/main/java/com/ycl/controller/epuipment/LoudspeakerController.java      |   10 +++++++---
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/epuipment/HandheldTerminalController.java b/ycl-platform/src/main/java/com/ycl/controller/epuipment/HandheldTerminalController.java
index f358c8b..cca4363 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/epuipment/HandheldTerminalController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/epuipment/HandheldTerminalController.java
@@ -47,20 +47,26 @@
     @ApiOperation("娣诲姞")
     @LogSave(operationType = "鎵嬫寔璁惧绠$悊", contain = "娣诲姞鎵嬫寔璁惧")
     public CommonResult add(@RequestBody HandheldTerminal handheldTerminal) {
-        return CommonResult.success(null);
+        handheldTerminal.setState(Short.valueOf("1"));
+        handheldTerminalService.save(handheldTerminal);
+        return CommonResult.success(true);
     }
 
     @PutMapping("/update")
     @ApiOperation("淇敼")
     @LogSave(operationType = "鎵嬫寔璁惧绠$悊", contain = "淇敼鎵嬫寔璁惧")
     public CommonResult update(@RequestBody HandheldTerminal handheldTerminal) {
-        return CommonResult.success(null);
+
+        handheldTerminalService.updateById(handheldTerminal);
+        return CommonResult.success(true);
     }
 
     @DeleteMapping("/delete/{id}")
     @ApiOperation("鍒犻櫎")
     @LogSave(operationType = "鎵嬫寔璁惧绠$悊", contain = "鍒犻櫎鎵嬫寔璁惧")
     public CommonResult delete(@PathVariable Long id) {
+
+        handheldTerminalService.removeById(id);
         return CommonResult.success(null);
     }
 
diff --git a/ycl-platform/src/main/java/com/ycl/controller/epuipment/LoudspeakerController.java b/ycl-platform/src/main/java/com/ycl/controller/epuipment/LoudspeakerController.java
index 5283fc6..c39e052 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/epuipment/LoudspeakerController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/epuipment/LoudspeakerController.java
@@ -61,21 +61,25 @@
     @ApiOperation("娣诲姞")
     @LogSave(operationType = "闊虫煴绠$悊", contain = "娣诲姞闊虫煴")
     public CommonResult add(@RequestBody Loudspeaker loudspeaker) {
-        return CommonResult.success(null);
+        loudspeaker.setState(Short.valueOf("1"));
+        loudspeakerService.save(loudspeaker);
+        return CommonResult.success(true);
     }
 
     @PutMapping("/update")
     @ApiOperation("缂栬緫")
     @LogSave(operationType = "闊虫煴绠$悊", contain = "淇敼闊虫煴")
     public CommonResult update(@RequestBody Loudspeaker loudspeaker) {
-        return CommonResult.success(null);
+        loudspeakerService.updateById(loudspeaker);
+        return CommonResult.success(true);
     }
 
     @DeleteMapping("/delete/{id}")
     @ApiOperation("鍒犻櫎")
     @LogSave(operationType = "闊虫煴绠$悊", contain = "鍒犻櫎闊虫煴")
     public CommonResult delete(@PathVariable Long id) {
-        return CommonResult.success(null);
+        loudspeakerService.removeById(id);
+        return CommonResult.success(true);
     }
 
 
diff --git a/ycl-platform/src/main/java/com/ycl/service/equipment/impl/LoudspeakerServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/equipment/impl/LoudspeakerServiceImpl.java
index c361626..a9a7b9d 100644
--- a/ycl-platform/src/main/java/com/ycl/service/equipment/impl/LoudspeakerServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/equipment/impl/LoudspeakerServiceImpl.java
@@ -23,7 +23,9 @@
     @Override
     public IPage<Loudspeaker> search(Integer pageSize, Integer currentPage, Short state) {
         Page<Loudspeaker> page = new Page<>(currentPage, pageSize);
-        LambdaQueryWrapper<Loudspeaker> queryWrapper = new LambdaQueryWrapper<Loudspeaker>().eq(state != null, Loudspeaker::getState, state);
+        LambdaQueryWrapper<Loudspeaker> queryWrapper = new LambdaQueryWrapper<Loudspeaker>()
+                .eq(state != null, Loudspeaker::getState, state)
+                .orderByDesc(Loudspeaker::getId);
         return baseMapper.selectPage(page, queryWrapper);
     }
 }

--
Gitblit v1.8.0