Browse Source

增加最大排序数

2024年9月24日14:30:57
thing_master
lishuai 1 year ago
parent
commit
bbf0ebac80
  1. 2
      modules/thing/src/main/java/com/thing/device/source/service/IotThingSourceService.java
  2. 15
      modules/thing/src/main/java/com/thing/device/source/service/impl/IotThingSourceServiceImpl.java

2
modules/thing/src/main/java/com/thing/device/source/service/IotThingSourceService.java

@ -49,5 +49,7 @@ public interface IotThingSourceService extends IBaseService<IotThingSourceEntity
List<String> attrGroup();
Long getMaxSort(String configType,Long fromId,Long rootId);
List<IotThingSourceDTO> attrGroupRootId(IotThingSourceReqDTO iotThingSourceDTO);
}

15
modules/thing/src/main/java/com/thing/device/source/service/impl/IotThingSourceServiceImpl.java

@ -566,6 +566,21 @@ public class IotThingSourceServiceImpl extends BaseServiceImpl<IotThingSourceMap
return strings.stream().filter(s -> !StringUtils.isBlank(s)).distinct().collect(Collectors.toList());
}
@Override
public Long getMaxSort(String configType, Long fromId,Long rootId) {
List<IotThingSourceEntity> 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<IotThingSourceDTO> attrGroupRootId(IotThingSourceReqDTO iotThingSourceDTO) {
List<IotThingSourceRelationDTO> iotThingSourceRelationDTOList = iotThingSourceDTO.getIotThingSourceRelationDTOList();

Loading…
Cancel
Save