Commit c428f82e9505f0f6aebe318e115c2bb7fe640cfd

Authored by 黄 x
1 parent 6049cb16

feat: add return column device_profile_id for master devices and slave devices

@@ -19,4 +19,7 @@ public class SelectItemDTO { @@ -19,4 +19,7 @@ public class SelectItemDTO {
19 19
20 @ApiModelProperty("设备类型") 20 @ApiModelProperty("设备类型")
21 private DeviceTypeEnum deviceType; 21 private DeviceTypeEnum deviceType;
  22 +
  23 + @ApiModelProperty("设备配置ID")
  24 + private String deviceProfileId;
22 } 25 }
@@ -45,7 +45,7 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev @@ -45,7 +45,7 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev
45 45
46 private final DeviceProfileDao deviceProfileDao; 46 private final DeviceProfileDao deviceProfileDao;
47 47
48 - private final OrganizationMapper ytOrganizationMapper; 48 + private final OrganizationMapper tkOrganizationMapper;
49 private final SceneLinkageMapper sceneLinkageMapper; 49 private final SceneLinkageMapper sceneLinkageMapper;
50 private final TriggerMapper triggerMapper; 50 private final TriggerMapper triggerMapper;
51 private final DoConditionMapper conditionMapper; 51 private final DoConditionMapper conditionMapper;
@@ -128,7 +128,7 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev @@ -128,7 +128,7 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev
128 DeviceProfile deviceProfile = 128 DeviceProfile deviceProfile =
129 deviceProfileDao.findById(id, UUID.fromString(deviceDTO.getProfileId())); 129 deviceProfileDao.findById(id, UUID.fromString(deviceDTO.getProfileId()));
130 TkOrganizationEntity organization = 130 TkOrganizationEntity organization =
131 - ytOrganizationMapper.selectById(deviceDTO.getOrganizationId()); 131 + tkOrganizationMapper.selectById(deviceDTO.getOrganizationId());
132 if (null == deviceProfile || null == organization) { 132 if (null == deviceProfile || null == organization) {
133 throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); 133 throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage());
134 } else if (!organization.getTenantId().equals(deviceTenantId)) { 134 } else if (!organization.getTenantId().equals(deviceTenantId)) {
@@ -347,7 +347,7 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev @@ -347,7 +347,7 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev
347 } 347 }
348 // 查询该组织的所有子类 348 // 查询该组织的所有子类
349 List<OrganizationDTO> organizationDTOS = 349 List<OrganizationDTO> organizationDTOS =
350 - ytOrganizationMapper.findOrganizationTreeList(tenantId, organizationIds); 350 + tkOrganizationMapper.findOrganizationTreeList(tenantId, organizationIds);
351 List<String> queryOrganizationIds = new ArrayList<>(); 351 List<String> queryOrganizationIds = new ArrayList<>();
352 organizationDTOS.forEach(item -> queryOrganizationIds.add(item.getId())); 352 organizationDTOS.forEach(item -> queryOrganizationIds.add(item.getId()));
353 return queryOrganizationIds; 353 return queryOrganizationIds;
@@ -331,7 +331,7 @@ @@ -331,7 +331,7 @@
331 331
332 <select id="masterDevices" resultMap="listInform"> 332 <select id="masterDevices" resultMap="listInform">
333 SELECT 333 SELECT
334 - base.tb_device_id as id,base.name,base.device_type 334 + base.tb_device_id as id,base.name,base.device_type,base.device_profile_id
335 FROM tk_device base 335 FROM tk_device base
336 LEFT JOIN device tde ON tde.ID :: TEXT = base.tb_device_id 336 LEFT JOIN device tde ON tde.ID :: TEXT = base.tb_device_id
337 <where> 337 <where>
@@ -356,7 +356,7 @@ @@ -356,7 +356,7 @@
356 356
357 <select id="slaveDevices" resultMap="listInform"> 357 <select id="slaveDevices" resultMap="listInform">
358 SELECT 358 SELECT
359 - ide.tb_device_id as id,ide.name,ide.device_type 359 + ide.tb_device_id as id,ide.name,ide.device_type,ide.device_profile_id
360 FROM (select * from relation where relation_type_group = 'COMMON' AND relation_type = 'Created' AND from_type = 'DEVICE' AND to_type = 'DEVICE' 360 FROM (select * from relation where relation_type_group = 'COMMON' AND relation_type = 'Created' AND from_type = 'DEVICE' AND to_type = 'DEVICE'
361 <if test="masterId !=null and masterId !=''"> 361 <if test="masterId !=null and masterId !=''">
362 AND from_id :: TEXT = #{masterId} 362 AND from_id :: TEXT = #{masterId}