设备型号版本功能完善

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
public Boolean bandDevice(AsDevice asDevice) {
int i = asDeviceMapper.insertAsDevice(asDevice);
Boolean execute = transactionTemplate.execute(e -> {
asDevice.setDeviceName(defaultName);
int i = bandSn(asDevice);
ServiceUtil.assertion(i == 0, "录入失败!");
AsDevice device = setDeviceValue(asDevice);
i = asDeviceMapper.insertAsDevice(device);
ServiceUtil.assertion(i == 0, "绑定失败!");
// Boolean execute = transactionTemplate.execute(e -> {
// asDevice.setDeviceName(defaultName);
// int i = bandSn(asDevice);
// ServiceUtil.assertion(i == 0, "录入失败!");
// setDeviceValue(asDevice);
// 切换默认设备
// toggleDevice(asDevice.getUserId(), asDevice.getDeviceId());
// return Boolean.TRUE;
// });
// if(Boolean.FALSE.equals(execute))throw new ServiceException("绑定失败");
logger.info("=================【绑定设备】成功==================");
return Boolean.TRUE;
});
if(Boolean.FALSE.equals(execute))throw new ServiceException("绑定失败");
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="soilMoisture != null">soil_moisture,</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>
</trim>
<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="soilMoisture != null">#{soilMoisture},</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>
</trim>
</insert>