From 926f0b4b3f3073ad7038228c60940d3235d560bb Mon Sep 17 00:00:00 2001 From: wty <419034340@qq.com> Date: Fri, 1 Dec 2023 10:44:15 +0800 Subject: [PATCH] adjust feature about add fz_device info --- .../aiit/xiuos/controller/FzDeviceManageController.java | 9 ++++++++- .../com/aiit/xiuos/dao/mappers/FzDeviceInfoMapper.java | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) 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 d7a39b8..e2ce86e 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 @@ -10,6 +10,7 @@ import com.aiit.xiuos.model.UserInfo; import com.aiit.xiuos.service.FzDeviceInfoService; import com.aiit.xiuos.tdengine.TDengineJDBCUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -52,7 +53,13 @@ public class FzDeviceManageController { @GetMapping("/select") public ResultRespons selectDevice(@RequestParam("type") String type, HttpServletRequest request){ - List fzDeviceInfos = fzDeviceInfoService.selectByType(type); + List fzDeviceInfos =null; + if(StringUtils.isEmpty(type)){ + fzDeviceInfos=fzDeviceInfoService.selectAll(); + }else{ + fzDeviceInfos= fzDeviceInfoService.selectByType(type); + } + return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",fzDeviceInfos); } 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 d1b5f4c..b611161 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 @@ -21,15 +21,15 @@ public interface FzDeviceInfoMapper { int updateByPrimaryKey(FzDeviceInfo record); - @Select("select * from fz_device_info") + @Select("select * from fz_device_info order by fz_device_user") List selectAll(); - @Select("select * from fz_device_info where fz_device_type =#{type}") + @Select("select * from fz_device_info where fz_device_type =#{type} order by fz_device_user") List selectByType(@Param("type") String type); - @Select("select * from fz_device_info where fz_device_status =#{status}") + @Select("select * from fz_device_info where fz_device_status =#{status} order by fz_device_user") List selectByStatus(@Param("status") String status); - @Select("select * from fz_device_info where fz_device_user =#{user}") + @Select("select * from fz_device_info where fz_device_user =#{user} order by fz_device_user") List selectByUser(@Param("user") String user); } \ No newline at end of file