Commit ea8db6ee2585daa9b6468c4a8f3c104fce688ca4
1 parent
8f24fcc7
fix: 设备相关接口
1.修改租户相关资源时,租户不能为空 2.修复设备修改异常的问题。
Showing
2 changed files
with
7 additions
and
0 deletions
@@ -5,8 +5,11 @@ import com.fasterxml.jackson.annotation.JsonFormat; | @@ -5,8 +5,11 @@ import com.fasterxml.jackson.annotation.JsonFormat; | ||
5 | import com.fasterxml.jackson.annotation.JsonInclude; | 5 | import com.fasterxml.jackson.annotation.JsonInclude; |
6 | import lombok.Data; | 6 | import lombok.Data; |
7 | import lombok.EqualsAndHashCode; | 7 | import lombok.EqualsAndHashCode; |
8 | +import org.thingsboard.server.common.data.yunteng.common.AddGroup; | ||
9 | +import org.thingsboard.server.common.data.yunteng.common.UpdateGroup; | ||
8 | import org.thingsboard.server.common.data.yunteng.enums.TenantStatusEnum; | 10 | import org.thingsboard.server.common.data.yunteng.enums.TenantStatusEnum; |
9 | 11 | ||
12 | +import javax.validation.constraints.NotEmpty; | ||
10 | import java.time.LocalDateTime; | 13 | import java.time.LocalDateTime; |
11 | 14 | ||
12 | @EqualsAndHashCode(callSuper = false) | 15 | @EqualsAndHashCode(callSuper = false) |
@@ -18,6 +21,9 @@ public class TenantDTO extends BaseDTO { | @@ -18,6 +21,9 @@ public class TenantDTO extends BaseDTO { | ||
18 | private String description; | 21 | private String description; |
19 | private String defaultConfig; | 22 | private String defaultConfig; |
20 | /** TB的租户ID */ | 23 | /** TB的租户ID */ |
24 | + @NotEmpty( | ||
25 | + message = "设备配置ID不能为空或者空字符串", | ||
26 | + groups = {UpdateGroup.class}) | ||
21 | private String tenantId; | 27 | private String tenantId; |
22 | /** 租户角色 */ | 28 | /** 租户角色 */ |
23 | private String[] roleIds; | 29 | private String[] roleIds; |
@@ -162,6 +162,7 @@ public class YtDeviceServiceImpl extends AbstractBaseService<DeviceMapper, YtDev | @@ -162,6 +162,7 @@ public class YtDeviceServiceImpl extends AbstractBaseService<DeviceMapper, YtDev | ||
162 | deviceTenantId = currentTenantId; | 162 | deviceTenantId = currentTenantId; |
163 | deviceDTO.setTenantId(currentTenantId); | 163 | deviceDTO.setTenantId(currentTenantId); |
164 | }else{ | 164 | }else{ |
165 | + deviceTenantId = deviceDTO.getTenantId(); | ||
165 | YtDevice device = baseMapper.selectById(deviceDTO.getId()); | 166 | YtDevice device = baseMapper.selectById(deviceDTO.getId()); |
166 | if(device == null){ | 167 | if(device == null){ |
167 | throw new YtDataValidationException("设备不存在!"); | 168 | throw new YtDataValidationException("设备不存在!"); |