diff --git a/modules/thing/src/main/java/com/thing/thing/dict/service/impl/IotThingDictServiceImpl.java b/modules/thing/src/main/java/com/thing/thing/dict/service/impl/IotThingDictServiceImpl.java index 1a72938..702c9b2 100644 --- a/modules/thing/src/main/java/com/thing/thing/dict/service/impl/IotThingDictServiceImpl.java +++ b/modules/thing/src/main/java/com/thing/thing/dict/service/impl/IotThingDictServiceImpl.java @@ -404,14 +404,18 @@ public class IotThingDictServiceImpl extends BaseServiceImpl resList = Lists.newArrayList(); if(toDictEntity.getSort()<=sort){ - iotThingDictEntities.stream().filter(s -> s.getSort() < sort) + List list = iotThingDictEntities.stream().filter(s -> s.getSort() < sort).toList(); + list.stream() .sorted(Comparator.comparing(IotThingDictEntity::getSort)) .forEach(s -> s.setSort(aLong.incrementAndGet())); + resList.addAll(list); iotThingDictEntity.setSort(aLong.incrementAndGet()); - mapper.update(iotThingDictEntity); - iotThingDictEntities.stream() + resList.add(iotThingDictEntity); + List list1 = iotThingDictEntities.stream().filter(s -> s.getSort() >= sort).toList(); + list1.stream() .sorted(Comparator.comparing(IotThingDictEntity::getSort)) - .filter(s -> s.getSort() >= sort).forEach(s -> s.setSort(aLong.incrementAndGet())); + .forEach(s -> s.setSort(aLong.incrementAndGet())); + resList.addAll(list1); }else{ List list = iotThingDictEntities.stream().filter(s -> s.getSort() <= sort).toList(); list.stream().sorted(Comparator.comparing(IotThingDictEntity::getSort))