获取/更新流量计地址/管道类型接口
This commit is contained in:
@ -178,7 +178,7 @@ public class DeviceReportInfoController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备当前状态
|
||||
* 更新设备当前运行状态
|
||||
*/
|
||||
@PostMapping("/update/run/status")
|
||||
public AjaxResult updateStatus(String deviceNumber,Integer status){
|
||||
@ -205,5 +205,62 @@ public class DeviceReportInfoController extends BaseController
|
||||
}
|
||||
return AjaxResult.error("设备不存在!");
|
||||
}
|
||||
/**
|
||||
* 更新设备地址值
|
||||
*/
|
||||
@PostMapping("/update/addr")
|
||||
public AjaxResult updateAddress(String deviceNumber,Integer addr){
|
||||
boolean update = new LambdaUpdateChainWrapper<>(deviceReportInfoMapper)
|
||||
.set(DeviceReportInfo::getAddr, addr)
|
||||
.eq(DeviceReportInfo::getSerialNumber, deviceNumber)
|
||||
.update();
|
||||
if(!update){
|
||||
throw new ServiceException("更新设备地址值失败!");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 查询设备地址值
|
||||
*/
|
||||
@GetMapping("/get/addr")
|
||||
public AjaxResult getAddress(String deviceNumber){
|
||||
List<DeviceReportInfo> list = new LambdaQueryChainWrapper<>(deviceReportInfoMapper)
|
||||
.select(DeviceReportInfo::getAddr)
|
||||
.eq(DeviceReportInfo::getSerialNumber, deviceNumber)
|
||||
.list();
|
||||
if(!list.isEmpty()){
|
||||
return AjaxResult.success(list.get(0).getAddr());
|
||||
}
|
||||
return AjaxResult.error("设备不存在!");
|
||||
}
|
||||
/**
|
||||
* 查询流量计设备型号
|
||||
*/
|
||||
@GetMapping("/get/flowModel")
|
||||
public AjaxResult getFlowModel(String deviceNumber){
|
||||
List<DeviceReportInfo> list = new LambdaQueryChainWrapper<>(deviceReportInfoMapper)
|
||||
.select(DeviceReportInfo::getFlowModel)
|
||||
.eq(DeviceReportInfo::getSerialNumber, deviceNumber)
|
||||
.list();
|
||||
if(!list.isEmpty()){
|
||||
return AjaxResult.success(list.get(0).getFlowModel());
|
||||
}
|
||||
return AjaxResult.error("设备不存在!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流量计类型
|
||||
*/
|
||||
@PostMapping("/update/flowModel")
|
||||
public AjaxResult updateFlowModel(Integer flowModel,String serialNumber){
|
||||
boolean update = new LambdaUpdateChainWrapper<>(deviceReportInfoMapper)
|
||||
.set(DeviceReportInfo::getFlowModel, flowModel)
|
||||
.eq(DeviceReportInfo::getSerialNumber, serialNumber)
|
||||
.update();
|
||||
if(!update){
|
||||
return AjaxResult.error("更新失败!");
|
||||
}
|
||||
return AjaxResult.success("更新成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user