|
|
|
@ -9,8 +9,6 @@ import com.mybatisflex.core.constant.SqlConsts; |
|
|
|
import com.mybatisflex.core.paginate.Page; |
|
|
|
import com.mybatisflex.core.query.QueryCondition; |
|
|
|
import com.mybatisflex.core.query.QueryWrapper; |
|
|
|
import com.mybatisflex.core.row.Db; |
|
|
|
import com.mybatisflex.core.update.UpdateChain; |
|
|
|
import com.thing.common.core.enumeration.DictTypeEnum; |
|
|
|
import com.thing.common.core.enumeration.IsDefaultEnum; |
|
|
|
import com.thing.common.core.exception.SysException; |
|
|
|
@ -391,11 +389,9 @@ public class IotThingDictServiceImpl extends BaseServiceImpl<IotThingDictMapper, |
|
|
|
public void dragAndDrop(Long id, Long toId, Long sort) { |
|
|
|
IotThingDictEntity iotThingDictEntity = mapper.selectOneById(id); |
|
|
|
IotThingDictEntity toDictEntity = mapper.selectOneById(toId); |
|
|
|
|
|
|
|
//自定义字典列表 |
|
|
|
List<IotThingDictEntity> noDefaultList = mapper.selectListByQuery(QueryWrapper.create().eq(IotThingDictEntity::getTenantCode, UserContext.getRealTenantCode()) |
|
|
|
.eq(IotThingDictEntity::getIsDefault, 1).ne(IotThingDictEntity::getId, id)); |
|
|
|
|
|
|
|
//自定义字典列表 |
|
|
|
List<IotThingDictEntity> defaultList = mapper.selectListByQuery(QueryWrapper.create() |
|
|
|
.eq(IotThingDictEntity::getIsDefault, 0).ne(IotThingDictEntity::getId, id)); |
|
|
|
@ -425,32 +421,18 @@ public class IotThingDictServiceImpl extends BaseServiceImpl<IotThingDictMapper, |
|
|
|
list.stream().sorted(Comparator.comparing(IotThingDictEntity::getSort)) |
|
|
|
.forEach(s -> { |
|
|
|
s.setSort(aLong.incrementAndGet()); |
|
|
|
// mapper.update(s); |
|
|
|
}); |
|
|
|
resList.addAll(list); |
|
|
|
iotThingDictEntity.setSort(aLong.incrementAndGet()); |
|
|
|
resList.add(iotThingDictEntity); |
|
|
|
|
|
|
|
List<IotThingDictEntity> list1 = iotThingDictEntities.stream().filter(s -> s.getSort() > sort).toList(); |
|
|
|
list1.stream().sorted(Comparator.comparing(IotThingDictEntity::getSort)) |
|
|
|
.forEach(s -> { |
|
|
|
s.setSort(aLong.incrementAndGet()); |
|
|
|
// mapper.update(s); |
|
|
|
}); |
|
|
|
resList.addAll(list1); |
|
|
|
|
|
|
|
} |
|
|
|
resList.forEach(s -> mapper.update(s)); |
|
|
|
|
|
|
|
// Db.executeBatch(iotThingDictEntities.size(), 1000, IotThingDictMapper.class, (mapper, index) -> { |
|
|
|
// IotThingDictEntity account = iotThingDictEntities.get(index); |
|
|
|
// UpdateChain.of(account).update(); |
|
|
|
// }); |
|
|
|
|
|
|
|
// iotThingDictEntities.forEach(s -> mapper.update(s)); |
|
|
|
// |
|
|
|
// int i = Db.updateEntitiesBatch(iotThingDictEntities, 1000); |
|
|
|
// System.out.println(i); |
|
|
|
this.updateBatch(resList); |
|
|
|
} |
|
|
|
|
|
|
|
} |