Showing
5 changed files
with
21 additions
and
14 deletions
@@ -33,10 +33,7 @@ import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | @@ -33,10 +33,7 @@ import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | ||
33 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | 33 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
34 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 34 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
35 | import org.thingsboard.server.common.data.yunteng.dto.*; | 35 | import org.thingsboard.server.common.data.yunteng.dto.*; |
36 | -import org.thingsboard.server.common.data.yunteng.enums.DataTypeEnum; | ||
37 | -import org.thingsboard.server.common.data.yunteng.enums.DeviceState; | ||
38 | -import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | ||
39 | -import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | 36 | +import org.thingsboard.server.common.data.yunteng.enums.*; |
40 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 37 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
41 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 38 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
42 | import org.thingsboard.server.controller.BaseController; | 39 | import org.thingsboard.server.controller.BaseController; |
@@ -383,14 +380,16 @@ public class TkDeviceController extends BaseController { | @@ -383,14 +380,16 @@ public class TkDeviceController extends BaseController { | ||
383 | @ApiParam(value = "设备标签") @RequestParam(value = "deviceLabel", required = false) | 380 | @ApiParam(value = "设备标签") @RequestParam(value = "deviceLabel", required = false) |
384 | String deviceLabel, | 381 | String deviceLabel, |
385 | @ApiParam(value = "设备配置ID") @RequestParam(value = "deviceProfileId", required = false) | 382 | @ApiParam(value = "设备配置ID") @RequestParam(value = "deviceProfileId", required = false) |
386 | - String deviceProfileId) | 383 | + String deviceProfileId, |
384 | + @ApiParam(value = "传输协议类型") @RequestParam(value = "transportType", required = false) | ||
385 | + TransportTypeEnum transportType) | ||
387 | throws ThingsboardException { | 386 | throws ThingsboardException { |
388 | return tkdeviceService.findDevicesByDeviceTypeAndOrganizationId( | 387 | return tkdeviceService.findDevicesByDeviceTypeAndOrganizationId( |
389 | deviceType, | 388 | deviceType, |
390 | getCurrentUser().getCurrentTenantId(), | 389 | getCurrentUser().getCurrentTenantId(), |
391 | organizationId, | 390 | organizationId, |
392 | deviceLabel, | 391 | deviceLabel, |
393 | - deviceProfileId); | 392 | + deviceProfileId,transportType); |
394 | } | 393 | } |
395 | 394 | ||
396 | 395 |
@@ -348,14 +348,15 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev | @@ -348,14 +348,15 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev | ||
348 | String tenantId, | 348 | String tenantId, |
349 | String organizationId, | 349 | String organizationId, |
350 | String deviceLabel, | 350 | String deviceLabel, |
351 | - String deviceProfileId) { | 351 | + String deviceProfileId, |
352 | + TransportTypeEnum transportTypeEnum) { | ||
352 | List<String> orgIds = organizationService.organizationAllIds(tenantId, organizationId); | 353 | List<String> orgIds = organizationService.organizationAllIds(tenantId, organizationId); |
353 | if (orgIds.isEmpty()) { | 354 | if (orgIds.isEmpty()) { |
354 | throw new TkDataValidationException(ErrorMessage.ORGANIZATION_NOT_EXTIED.getMessage()); | 355 | throw new TkDataValidationException(ErrorMessage.ORGANIZATION_NOT_EXTIED.getMessage()); |
355 | } | 356 | } |
356 | return baseMapper.findDevicesByDeviceTypeAndOrganizationId(orgIds, | 357 | return baseMapper.findDevicesByDeviceTypeAndOrganizationId(orgIds, |
357 | deviceType==null?null:deviceType.name() | 358 | deviceType==null?null:deviceType.name() |
358 | - ,deviceLabel,deviceProfileId); | 359 | + ,deviceLabel,deviceProfileId,transportTypeEnum); |
359 | } | 360 | } |
360 | 361 | ||
361 | @Override | 362 | @Override |
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
6 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
7 | import org.thingsboard.server.common.data.yunteng.dto.*; | 7 | import org.thingsboard.server.common.data.yunteng.dto.*; |
8 | +import org.thingsboard.server.common.data.yunteng.enums.TransportTypeEnum; | ||
8 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceEntity; | 9 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceEntity; |
9 | 10 | ||
10 | import java.util.List; | 11 | import java.util.List; |
@@ -152,5 +153,6 @@ public interface DeviceMapper extends BaseMapper<TkDeviceEntity> { | @@ -152,5 +153,6 @@ public interface DeviceMapper extends BaseMapper<TkDeviceEntity> { | ||
152 | @Param("orgIds")List<String> orgIds, | 153 | @Param("orgIds")List<String> orgIds, |
153 | @Param("deviceType") String deviceType, | 154 | @Param("deviceType") String deviceType, |
154 | @Param("deviceLabel") String deviceLabel, | 155 | @Param("deviceLabel") String deviceLabel, |
155 | - @Param("deviceProfileId") String deviceProfileId); | 156 | + @Param("deviceProfileId") String deviceProfileId, |
157 | + @Param("transportType")TransportTypeEnum transportType) ; | ||
156 | } | 158 | } |
@@ -9,6 +9,7 @@ import org.thingsboard.server.common.data.yunteng.dto.SelectItemDTO; | @@ -9,6 +9,7 @@ import org.thingsboard.server.common.data.yunteng.dto.SelectItemDTO; | ||
9 | import org.thingsboard.server.common.data.yunteng.enums.DataTypeEnum; | 9 | import org.thingsboard.server.common.data.yunteng.enums.DataTypeEnum; |
10 | import org.thingsboard.server.common.data.yunteng.enums.DeviceState; | 10 | import org.thingsboard.server.common.data.yunteng.enums.DeviceState; |
11 | import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | 11 | import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; |
12 | +import org.thingsboard.server.common.data.yunteng.enums.TransportTypeEnum; | ||
12 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 13 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
13 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceEntity; | 14 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceEntity; |
14 | 15 | ||
@@ -62,11 +63,12 @@ public interface TkDeviceService extends BaseService<TkDeviceEntity> { | @@ -62,11 +63,12 @@ public interface TkDeviceService extends BaseService<TkDeviceEntity> { | ||
62 | * @return 设备列表 | 63 | * @return 设备列表 |
63 | */ | 64 | */ |
64 | List<DeviceDTO> findDevicesByDeviceTypeAndOrganizationId( | 65 | List<DeviceDTO> findDevicesByDeviceTypeAndOrganizationId( |
65 | - DeviceTypeEnum deviceType, | ||
66 | - String tenantId, | ||
67 | - String organizationId, | ||
68 | - String deviceLabel, | ||
69 | - String deviceProfileId); | 66 | + DeviceTypeEnum deviceType, |
67 | + String tenantId, | ||
68 | + String organizationId, | ||
69 | + String deviceLabel, | ||
70 | + String deviceProfileId, | ||
71 | + TransportTypeEnum transportTypeEnum); | ||
70 | 72 | ||
71 | 73 | ||
72 | List<DeviceDTO> findDevicesByOrganizationIds( | 74 | List<DeviceDTO> findDevicesByOrganizationIds( |
@@ -499,6 +499,9 @@ | @@ -499,6 +499,9 @@ | ||
499 | <if test="deviceProfileId !=null and deviceProfileId !=''"> | 499 | <if test="deviceProfileId !=null and deviceProfileId !=''"> |
500 | AND ifd.device_profile_id = #{deviceProfileId} | 500 | AND ifd.device_profile_id = #{deviceProfileId} |
501 | </if> | 501 | </if> |
502 | + <if test="transportType !=null"> | ||
503 | + AND dev.transport_type = #{transportType} | ||
504 | + </if> | ||
502 | and ifd.organization_id in | 505 | and ifd.organization_id in |
503 | <foreach collection="orgIds" item="orgId" open="(" separator="," close=")"> | 506 | <foreach collection="orgIds" item="orgId" open="(" separator="," close=")"> |
504 | #{orgId} | 507 | #{orgId} |