From ef50d5c947adcf27b18e898c7f193de01a7f0f9c Mon Sep 17 00:00:00 2001
From: wty <419034340@qq.com>
Date: Tue, 1 Aug 2023 14:16:46 +0800
Subject: [PATCH 1/3] add feature about select device by status
---
xiuosiot-backend/pom.xml | 3 ++-
.../java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java | 3 +++
.../java/com/aiit/xiuos/service/FzDeviceInfoService.java | 1 +
.../com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java | 5 +++++
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/xiuosiot-backend/pom.xml b/xiuosiot-backend/pom.xml
index 39caece..d6e3eaa 100644
--- a/xiuosiot-backend/pom.xml
+++ b/xiuosiot-backend/pom.xml
@@ -12,7 +12,7 @@
xiuos
0.0.1-SNAPSHOT
xiuos
- Demo project for Spring Boot
+ xiuosiot
1.8
@@ -163,6 +163,7 @@
test
+
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java
index 1a68843..61a6a53 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java
@@ -26,4 +26,7 @@ public interface FzDeviceInfoMapper {
@Select("select * from fz_device_info where fz_device_type =#{type}")
List selectByType(@Param("type") String type);
+
+ @Select("select * from fz_device_info where fz_device_status =#{status}")
+ List selectByStatus(@Param("status") String status);
}
\ No newline at end of file
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java
index 30db78d..345f963 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java
@@ -11,5 +11,6 @@ public interface FzDeviceInfoService {
int addDevice(FzDeviceInfo fzDeviceInfo);
int updateDevice(FzDeviceInfo fzDeviceInfo);
int deleteDevice(String deviceNo);
+ List selectByStatus(String status);
}
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java
index 306b44b..f060636 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java
@@ -40,4 +40,9 @@ public class FzDeviceInfoServiceImpl implements FzDeviceInfoService {
public int deleteDevice(String deviceNo) {
return fzDeviceInfoMapper.deleteByPrimaryKey(deviceNo);
}
+
+ @Override
+ public List selectByStatus(String status) {
+ return fzDeviceInfoMapper.selectByStatus(status);
+ }
}
From 2fa02050ef36a76cd749ea906ccded967c2d53c6 Mon Sep 17 00:00:00 2001
From: wty <419034340@qq.com>
Date: Wed, 2 Aug 2023 14:46:49 +0800
Subject: [PATCH 2/3] add new feature about select device by user
---
xiuosiot-backend/pom.xml | 11 +++++++--
.../controller/FzDeviceManageController.java | 24 +++++++++++++++++++
.../xiuos/dao/mappers/FzDeviceInfoMapper.java | 3 +++
.../xiuos/service/FzDeviceInfoService.java | 1 +
.../service/impl/FzDeviceInfoServiceImpl.java | 5 ++++
5 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/xiuosiot-backend/pom.xml b/xiuosiot-backend/pom.xml
index d6e3eaa..115ecc9 100644
--- a/xiuosiot-backend/pom.xml
+++ b/xiuosiot-backend/pom.xml
@@ -123,11 +123,18 @@
- cn.zhxu
+ com.ejlchina
okhttps-fastjson
- 4.0.1
+ 3.5.3
+
+ com.squareup.okio
+ okio
+ 2.8.0
+
+
+
org.springframework.boot
spring-boot-starter-mail
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/FzDeviceManageController.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/FzDeviceManageController.java
index 929a5a5..d7a39b8 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/FzDeviceManageController.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/controller/FzDeviceManageController.java
@@ -68,6 +68,30 @@ public class FzDeviceManageController {
}
+ @GetMapping("/selectByStatus")
+ public ResultRespons selectDeviceByStatus(@RequestParam("status") String status, HttpServletRequest request){
+ List fzDeviceInfos = fzDeviceInfoService.selectByStatus(status);
+ if(fzDeviceInfos!=null){
+ return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",fzDeviceInfos);
+ }else
+ {
+ return new ResultRespons(Constant.SUCCESS_CODE,"设备不存在!");
+ }
+
+ }
+
+ @GetMapping("/selectByUser")
+ public ResultRespons selectDeviceByUser(@RequestParam("user") String user, HttpServletRequest request){
+ List fzDeviceInfos= fzDeviceInfoService.selectByUser(user);
+ if(fzDeviceInfos!=null){
+ return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",fzDeviceInfos);
+ }else
+ {
+ return new ResultRespons(Constant.SUCCESS_CODE,"设备不存在!");
+ }
+
+ }
+
@GetMapping("/selectAll")
public ResultRespons selectDevice(){
List fzDeviceInfos = fzDeviceInfoService.selectAll();
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java
index 61a6a53..d1b5f4c 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java
@@ -29,4 +29,7 @@ public interface FzDeviceInfoMapper {
@Select("select * from fz_device_info where fz_device_status =#{status}")
List selectByStatus(@Param("status") String status);
+
+ @Select("select * from fz_device_info where fz_device_user =#{user}")
+ List selectByUser(@Param("user") String user);
}
\ No newline at end of file
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java
index 345f963..41c97a0 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/FzDeviceInfoService.java
@@ -12,5 +12,6 @@ public interface FzDeviceInfoService {
int updateDevice(FzDeviceInfo fzDeviceInfo);
int deleteDevice(String deviceNo);
List selectByStatus(String status);
+ List selectByUser(String user);
}
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java
index f060636..771ff96 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/service/impl/FzDeviceInfoServiceImpl.java
@@ -45,4 +45,9 @@ public class FzDeviceInfoServiceImpl implements FzDeviceInfoService {
public List selectByStatus(String status) {
return fzDeviceInfoMapper.selectByStatus(status);
}
+
+ @Override
+ public List selectByUser(String user) {
+ return fzDeviceInfoMapper.selectByUser(user);
+ }
}
From 6434f1f7985acfb8190251463e58ce79cd9dcde3 Mon Sep 17 00:00:00 2001
From: wty <419034340@qq.com>
Date: Thu, 3 Aug 2023 16:12:20 +0800
Subject: [PATCH 3/3] fix bug
---
.../main/java/com/aiit/xiuos/socket/GZJCWebSocketServer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xiuosiot-backend/src/main/java/com/aiit/xiuos/socket/GZJCWebSocketServer.java b/xiuosiot-backend/src/main/java/com/aiit/xiuos/socket/GZJCWebSocketServer.java
index 98cbfaa..c035d85 100644
--- a/xiuosiot-backend/src/main/java/com/aiit/xiuos/socket/GZJCWebSocketServer.java
+++ b/xiuosiot-backend/src/main/java/com/aiit/xiuos/socket/GZJCWebSocketServer.java
@@ -10,7 +10,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-@ServerEndpoint(value = "/websocket/haier/{clientId}")
+@ServerEndpoint(value = "/websocket/gzjc/{clientId}")
@Component
@Slf4j
public class GZJCWebSocketServer {