设备型号版本功能完善

This commit is contained in:
SjS 2025-04-16 18:10:50 +08:00
parent dff5c1cb8c
commit 3637f31f3f
2 changed files with 16 additions and 11 deletions

View File

@ -507,18 +507,19 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
*/ */
@Override @Override
public Boolean bandDevice(AsDevice asDevice) { public Boolean bandDevice(AsDevice asDevice) {
int i = asDeviceMapper.insertAsDevice(asDevice); Boolean execute = transactionTemplate.execute(e -> {
ServiceUtil.assertion(i == 0, "绑定失败!"); asDevice.setDeviceName(defaultName);
// Boolean execute = transactionTemplate.execute(e -> { int i = bandSn(asDevice);
// asDevice.setDeviceName(defaultName); ServiceUtil.assertion(i == 0, "录入失败!");
// int i = bandSn(asDevice); AsDevice device = setDeviceValue(asDevice);
// ServiceUtil.assertion(i == 0, "录入失败!"); i = asDeviceMapper.insertAsDevice(device);
// setDeviceValue(asDevice); ServiceUtil.assertion(i == 0, "绑定失败!");
// 切换默认设备 // 切换默认设备
// toggleDevice(asDevice.getUserId(), asDevice.getDeviceId()); // toggleDevice(asDevice.getUserId(), asDevice.getDeviceId());
// return Boolean.TRUE; logger.info("=================【绑定设备】成功==================");
// }); return Boolean.TRUE;
// if(Boolean.FALSE.equals(execute))throw new ServiceException("绑定失败"); });
if(Boolean.FALSE.equals(execute))throw new ServiceException("绑定失败");
return true; return true;
} }

View File

@ -161,6 +161,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="regularWateringJson != null">regular_watering_json,</if> <if test="regularWateringJson != null">regular_watering_json,</if>
<if test="soilMoisture != null">soil_moisture,</if> <if test="soilMoisture != null">soil_moisture,</if>
<if test="waterIntensitySwitch != null">water_intensity_switch,</if> <if test="waterIntensitySwitch != null">water_intensity_switch,</if>
<if test="bluetoothId != null">bluetooth_id,</if>
<if test="bluetoothName != null">bluetooth_name,</if>
<if test="pre != null">pre</if> <if test="pre != null">pre</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -194,6 +196,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="regularWateringJson != null">#{regularWateringJson},</if> <if test="regularWateringJson != null">#{regularWateringJson},</if>
<if test="soilMoisture != null">#{soilMoisture},</if> <if test="soilMoisture != null">#{soilMoisture},</if>
<if test="waterIntensitySwitch != null">#{waterIntensitySwitch},</if> <if test="waterIntensitySwitch != null">#{waterIntensitySwitch},</if>
<if test="bluetoothId != null">#{bluetoothId},</if>
<if test="bluetoothName != null">#{bluetoothName},</if>
<if test="pre != null">#{pre}</if> <if test="pre != null">#{pre}</if>
</trim> </trim>
</insert> </insert>