大屏墒情设备实时数据接口
This commit is contained in:
parent
c11265ed86
commit
3d6372cee9
@ -13,6 +13,11 @@ public class DeviceRealtimedataMeteorologyController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceRealtimedataMeteorologyServiceImpl deviceRealtimedataMeteorologyService;
|
private DeviceRealtimedataMeteorologyServiceImpl deviceRealtimedataMeteorologyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新的一条气象数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping(value = "/weather/realtimedata")
|
@GetMapping(value = "/weather/realtimedata")
|
||||||
public AjaxResult getLatestWeatherRealtimedata() {
|
public AjaxResult getLatestWeatherRealtimedata() {
|
||||||
return AjaxResult.success(deviceRealtimedataMeteorologyService.getLatestWeatherRealtimedata());
|
return AjaxResult.success(deviceRealtimedataMeteorologyService.getLatestWeatherRealtimedata());
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.fastbee.data.controller.deviceData;
|
||||||
|
|
||||||
|
import com.fastbee.common.core.domain.AjaxResult;
|
||||||
|
import com.fastbee.deviceData.service.impl.DeviceRealtimedataMoistureServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController()
|
||||||
|
@RequestMapping("/moisture")
|
||||||
|
public class DeviceRealtimedataMoistureController {
|
||||||
|
@Autowired
|
||||||
|
private DeviceRealtimedataMoistureServiceImpl deviceRealtimedataMoistureServiceImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新一条墒情数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/weather/realtimedata")
|
||||||
|
public AjaxResult getLatestWeatherRealtimedata() {
|
||||||
|
return AjaxResult.success(deviceRealtimedataMoistureServiceImpl.getLatestWeatherRealtimedata());
|
||||||
|
}
|
||||||
|
}
|
@ -23,9 +23,8 @@ import com.fastbee.common.core.domain.BaseEntity;
|
|||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("iot_device_realtimedata_moisture")
|
@TableName("iot_device_realtimedata_moisture")
|
||||||
public class DeviceRealtimedataMoisture extends BaseEntity
|
public class DeviceRealtimedataMoisture
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -58,4 +58,10 @@ public interface IDeviceRealtimedataMoistureService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeviceRealtimedataMoistureById(Long id);
|
public int deleteDeviceRealtimedataMoistureById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新一条墒情数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public DeviceRealtimedataMoisture getLatestWeatherRealtimedata();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.fastbee.deviceData.service.impl;
|
package com.fastbee.deviceData.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.fastbee.deviceData.mapper.DeviceRealtimedataMoistureMapper;
|
import com.fastbee.deviceData.mapper.DeviceRealtimedataMoistureMapper;
|
||||||
@ -90,4 +92,14 @@ public class DeviceRealtimedataMoistureServiceImpl implements IDeviceRealtimedat
|
|||||||
{
|
{
|
||||||
return deviceRealtimedataMoistureMapper.deleteDeviceRealtimedataMoistureById(id);
|
return deviceRealtimedataMoistureMapper.deleteDeviceRealtimedataMoistureById(id);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取最新一条墒情数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public DeviceRealtimedataMoisture getLatestWeatherRealtimedata(){
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.orderByDesc("real_time");
|
||||||
|
queryWrapper.last("limit 1");
|
||||||
|
return deviceRealtimedataMoistureMapper.selectOne(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user