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} +