From 522f7c4e3548967834ca3328c168c6598376bea7 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Thu, 7 Nov 2024 08:36:29 +0800 Subject: [PATCH] =?UTF-8?q?id=E8=8E=B7=E5=8F=96=E8=AE=BE=E5=A4=87=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/controller/DcDeviceController.java | 9 ++++++++- .../main/java/com/zc/business/mapper/DcDeviceMapper.java | 3 +++ .../java/com/zc/business/service/IDcDeviceService.java | 3 +++ .../zc/business/service/impl/DcDeviceServiceImpl.java | 6 ++++++ .../main/resources/mapper/business/DcDeviceMapper.xml | 3 +++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index e5d25f7b..76c5857c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -80,7 +80,14 @@ public class DcDeviceController extends BaseController { private ISysConfigService configService; //*********************************设备增删改查****************************************** - + //根据设备id查询设备信息 + @PostMapping("/getDeviceById") + public AjaxResult getDeviceById(@RequestBody DcDevice dcDevice) { + if (dcDevice==null||dcDevice.getIotDeviceId()==null){ + return AjaxResult.error("参数异常"); + } + return AjaxResult.success(dcDeviceService.getDcDeviceById(dcDevice.getIotDeviceId())); + } /** * 分页查询设备列表 * diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java index f1e845dc..b2e7ce3e 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java @@ -42,4 +42,7 @@ public interface DcDeviceMapper extends BaseMapper { //获取收费站摄像头 List selectTollStationCamPile(@Param("direction") String direction,@Param("startMileage") String startMileage,@Param("endMileage") String endMileage); + + //获取设备信息 + DcDevice getDcDeviceById(@Param("iotDeviceId") String iotDeviceId); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java index fe5f8fb4..acffb060 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java @@ -8,6 +8,7 @@ import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcStakeMark; import com.zc.common.core.httpclient.exception.HttpException; import io.swagger.v3.oas.models.security.SecurityScheme; +import org.apache.ibatis.annotations.Param; import sun.reflect.generics.tree.VoidDescriptor; import java.io.IOException; @@ -129,4 +130,6 @@ public interface IDcDeviceService extends IService { Integer updateTollStationCameraStatus(DcDevice dcDevice); //获取附近收费站摄像头 List selectTollStationCamPile(String direction, String startMileage, String endMileage); + //获取设备信息 + DcDevice getDcDeviceById(@Param("iotDeviceId") String iotDeviceId); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java index 3d6cd0f0..3a52d5e0 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java @@ -24,6 +24,7 @@ import com.zc.business.service.IMiddleDatabaseService; import com.zc.common.core.httpclient.OkHttp; import com.zc.common.core.httpclient.exception.HttpException; import okhttp3.Response; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -659,5 +660,10 @@ public class DcDeviceServiceImpl extends ServiceImpl i public List selectTollStationCamPile(String direction, String startMileage, String endMileage) { return dcDeviceMapper.selectTollStationCamPile(direction, startMileage, endMileage); } + //获取设备信息 + @Override + public DcDevice getDcDeviceById(String iotDeviceId) { + return dcDeviceMapper.getDcDeviceById(iotDeviceId); + } } diff --git a/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml b/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml index 86178157..e2f37ba6 100644 --- a/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml @@ -199,4 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and (t1.facilities_type = '5'|| t1.facilities_type = '4') and t2.mileage >= #{startMileage} and t2.mileage <= #{endMileage} +