获取/更新流量计地址/管道类型接口

This commit is contained in:
蒾酒
2025-01-01 01:21:58 +08:00
parent f3b9e04be9
commit e2bd886b57
3 changed files with 81 additions and 2 deletions

View File

@ -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("更新成功!");
}
}

View File

@ -174,12 +174,24 @@ public class DeviceReportInfo extends BaseEntity
@Excel(name = "yun'xing")
@ApiModelProperty("yun'xing")
private Long runStatus;
/** 设备地址值 */
@Excel(name = "设备地址值")
@ApiModelProperty("设备地址值")
private Long addr;
/** 流量计型号1管段式2卡片式 */
@Excel(name = "流量计型号1管段式2卡片式")
@ApiModelProperty("流量计型号1管段式2卡片式")
private Integer flowModel;
//----------------------------------------------------------业务字段-----------------------------------------------------------
/** 是否自动审核 */
@TableField(exist = false)
private Boolean autoReview ;
/** 设备类型1.水电双计 2.流量计 */
@TableField(exist = false)
private String searchValue;
// @TableField(exist = false)

View File

@ -36,10 +36,12 @@
<result property="areaCode" column="area_code" />
<result property="deptId" column="dept_id" />
<result property="runStatus" column="run_status" />
<result property="addr" column="addr" />
<result property="flowModel" column="flow_model" />
</resultMap>
<sql id="selectDeviceReportInfoVo">
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name, device_id, status, powers_time, type, longitude, latitude,on_line,area_code,dept_id,run_status from iot_device_report_info
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name, device_id, status, powers_time, type, longitude, latitude,on_line,area_code,dept_id,run_status, addr, flow_model from iot_device_report_info
</sql>
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
@ -75,6 +77,8 @@
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="runStatus != null "> and run_status = #{runStatus}</if>
<if test="addr != null "> and addr = #{addr}</if>
<if test="flowModel != null "> and flow_model = #{flowModel}</if>
</where>
<!-- 添加排序 -->
order by powers_time desc
@ -117,6 +121,8 @@
<if test="onLine != null">on_line,</if>
<if test="areaCode != null">area_code,</if>
<if test="deptId != null">dept_id,</if>
<if test="addr != null">addr,</if>
<if test="flowModel != null">flow_model,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="imei != null and imei != ''">#{imei},</if>
@ -148,6 +154,8 @@
<if test="onLine != null">#{onLine},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="deptId != null">#{deptId},</if>
<if test="addr != null">#{addr},</if>
<if test="flowModel != null">#{flowModel},</if>
</trim>
</insert>
@ -183,6 +191,8 @@
<if test="onLine != null">on_line = #{onLine},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="addr != null">addr = #{addr},</if>
<if test="flowModel != null">flow_model = #{flowModel},</if>
</trim>
where id = #{id}
</update>