Browse Source

id获取设备信息

develop
wangsixiang 3 weeks ago
parent
commit
522f7c4e35
  1. 9
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  2. 3
      zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java
  3. 3
      zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
  4. 6
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
  5. 3
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

9
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()));
}
/**
* 分页查询设备列表
*

3
zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java

@ -42,4 +42,7 @@ public interface DcDeviceMapper extends BaseMapper<DcDevice> {
//获取收费站摄像头
List<DcDevice> selectTollStationCamPile(@Param("direction") String direction,@Param("startMileage") String startMileage,@Param("endMileage") String endMileage);
//获取设备信息
DcDevice getDcDeviceById(@Param("iotDeviceId") String iotDeviceId);
}

3
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<DcDevice> {
Integer updateTollStationCameraStatus(DcDevice dcDevice);
//获取附近收费站摄像头
List<DcDevice> selectTollStationCamPile(String direction, String startMileage, String endMileage);
//获取设备信息
DcDevice getDcDeviceById(@Param("iotDeviceId") String iotDeviceId);
}

6
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<DcDeviceMapper, DcDevice> i
public List<DcDevice> selectTollStationCamPile(String direction, String startMileage, String endMileage) {
return dcDeviceMapper.selectTollStationCamPile(direction, startMileage, endMileage);
}
//获取设备信息
@Override
public DcDevice getDcDeviceById(String iotDeviceId) {
return dcDeviceMapper.getDcDeviceById(iotDeviceId);
}
}

3
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 &lt;= #{endMileage}
</select>
<select id="getDcDeviceById" resultType="com.zc.business.domain.DcDevice">
select device_state from dc_device where iot_device_id=#{iotDeviceId}
</select>
</mapper>

Loading…
Cancel
Save