Commit a60a9c330b2925dd3798589c4db34780c8891058

Authored by 云中非
1 parent 82f038fe

fix: 设备配置删除异常

1.设备配置删除提示不存在的问题修复。
@@ -151,10 +151,12 @@ public class YtDeviceProfileController extends BaseController { @@ -151,10 +151,12 @@ public class YtDeviceProfileController extends BaseController {
151 @DeleteMapping 151 @DeleteMapping
152 @ApiOperation("删除") 152 @ApiOperation("删除")
153 public void deleteDevices(@Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) throws ThingsboardException { 153 public void deleteDevices(@Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) throws ThingsboardException {
  154 + ytDeviceProfileService.deleteDeviceProfiles(getCurrentUser().getCurrentTenantId(), deleteDTO.getIds());
  155 +
154 for (String id : deleteDTO.getIds()) { 156 for (String id : deleteDTO.getIds()) {
155 deleteTbDeviceProfile(id); 157 deleteTbDeviceProfile(id);
156 } 158 }
157 - ytDeviceProfileService.deleteDeviceProfiles(getCurrentUser().getCurrentTenantId(), deleteDTO.getIds()); 159 +
158 } 160 }
159 161
160 private void deleteTbDeviceProfile(String strDeviceProfileId) throws ThingsboardException { 162 private void deleteTbDeviceProfile(String strDeviceProfileId) throws ThingsboardException {
@@ -139,17 +139,14 @@ public class YtDeviceProfileServiceImpl @@ -139,17 +139,14 @@ public class YtDeviceProfileServiceImpl
139 if (count > 0) { 139 if (count > 0) {
140 throw new YtDataValidationException("有设备使用待删除配置,请先删除设备或者修改设备配置"); 140 throw new YtDataValidationException("有设备使用待删除配置,请先删除设备或者修改设备配置");
141 } 141 }
142 - // TODO check if ids bind to iotfs_key_value_mapping  
143 - List<UUID> deletedIds = new ArrayList<>(); 142 +
144 for (String id : ids) { 143 for (String id : ids) {
145 - deletedIds.add(UUID.fromString(id));  
146 LambdaQueryWrapper filter = new QueryWrapper<AlarmProfile>() 144 LambdaQueryWrapper filter = new QueryWrapper<AlarmProfile>()
147 .lambda() 145 .lambda()
148 .eq(AlarmProfile::getTenantId, tenantId) 146 .eq(AlarmProfile::getTenantId, tenantId)
149 .in(AlarmProfile::getDeviceProfileId, id); 147 .in(AlarmProfile::getDeviceProfileId, id);
150 alarmProfileMapper.delete(filter); 148 alarmProfileMapper.delete(filter);
151 } 149 }
152 - deviceProfileDao.removeAllByIds(deletedIds);  
153 150
154 } 151 }
155 152