From bbf0ebac8046d156a85d1d4bf03efee0252e2986 Mon Sep 17 00:00:00 2001 From: lishuai Date: Tue, 24 Sep 2024 14:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=80=E5=A4=A7=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=95=B0=202024=E5=B9=B49=E6=9C=8824=E6=97=A514:30:57?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/service/IotThingSourceService.java | 2 ++ .../service/impl/IotThingSourceServiceImpl.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/modules/thing/src/main/java/com/thing/device/source/service/IotThingSourceService.java b/modules/thing/src/main/java/com/thing/device/source/service/IotThingSourceService.java index fcd88bc..be79a95 100644 --- a/modules/thing/src/main/java/com/thing/device/source/service/IotThingSourceService.java +++ b/modules/thing/src/main/java/com/thing/device/source/service/IotThingSourceService.java @@ -49,5 +49,7 @@ public interface IotThingSourceService extends IBaseService attrGroup(); + Long getMaxSort(String configType,Long fromId,Long rootId); + List attrGroupRootId(IotThingSourceReqDTO iotThingSourceDTO); } diff --git a/modules/thing/src/main/java/com/thing/device/source/service/impl/IotThingSourceServiceImpl.java b/modules/thing/src/main/java/com/thing/device/source/service/impl/IotThingSourceServiceImpl.java index 88723b4..f26cb84 100644 --- a/modules/thing/src/main/java/com/thing/device/source/service/impl/IotThingSourceServiceImpl.java +++ b/modules/thing/src/main/java/com/thing/device/source/service/impl/IotThingSourceServiceImpl.java @@ -566,6 +566,21 @@ public class IotThingSourceServiceImpl extends BaseServiceImpl !StringUtils.isBlank(s)).distinct().collect(Collectors.toList()); } + @Override + public Long getMaxSort(String configType, Long fromId,Long rootId) { + List iotThingSourceEntities = mapper.selectListByQuery( + new QueryWrapper() + .eq(IotThingSourceEntity::getFromId, fromId) + .eq(IotThingSourceEntity::getConfigType, configType) + .eq(IotThingSourceEntity::getRootId, rootId) + .eq(IotThingSourceEntity::getTenantCode, UserContext.getRealTenantCode()) + ); + if(CollectionUtils.isEmpty(iotThingSourceEntities)){ + return 0L; + } + return iotThingSourceEntities.stream().max(Comparator.comparing(IotThingSourceEntity::getSort)).get().getSort()+1; + } + @Override public List attrGroupRootId(IotThingSourceReqDTO iotThingSourceDTO) { List iotThingSourceRelationDTOList = iotThingSourceDTO.getIotThingSourceRelationDTOList();