Showing
1 changed file
with
9 additions
and
3 deletions
... | ... | @@ -15,6 +15,7 @@ import org.thingsboard.server.common.data.User; |
15 | 15 | import org.thingsboard.server.common.data.audit.ActionType; |
16 | 16 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
17 | 17 | import org.thingsboard.server.common.data.id.EdgeId; |
18 | +import org.thingsboard.server.common.data.id.TenantId; | |
18 | 19 | import org.thingsboard.server.common.data.id.UserId; |
19 | 20 | import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; |
20 | 21 | import org.thingsboard.server.common.data.yunteng.common.DeleteGroup; |
... | ... | @@ -195,9 +196,14 @@ public class YtAdminController extends BaseController { |
195 | 196 | |
196 | 197 | private void updateOrSaveTenant(TenantReqDTO tenantReqDTO) throws ThingsboardException { |
197 | 198 | try { |
198 | - boolean isCreate = tenantReqDTO.getId() == null; | |
199 | - // 增加TB的租户创建 | |
200 | - Tenant tbTenant = new Tenant(); | |
199 | + boolean isCreate = tenantReqDTO.getTenantId() == null; | |
200 | + Tenant tbTenant; | |
201 | + if(isCreate){ | |
202 | + // 增加TB的租户创建 | |
203 | + tbTenant = new Tenant(); | |
204 | + }else{ | |
205 | + tbTenant = new Tenant(new TenantId(UUID.fromString(tenantReqDTO.getTenantId()))); | |
206 | + } | |
201 | 207 | tbTenant.setTitle(tenantReqDTO.getName()); |
202 | 208 | tbTenant = tenantService.saveTenant(tbTenant); |
203 | 209 | if (isCreate) { | ... | ... |