Commit 0184db76 by 吕明尚

修改查询正在保洁中的保洁记录

parent d981eb90
...@@ -296,13 +296,15 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC ...@@ -296,13 +296,15 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SCleanRecords::getConsumerId,user.getId()); queryWrapper.in(SCleanRecords::getConsumerId,user.getId());
queryWrapper.in(SCleanRecords::getStatus, CleaningStatusEnum.CLEANING.getCode()); queryWrapper.in(SCleanRecords::getStatus, CleaningStatusEnum.CLEANING.getCode());
SCleanRecords sCleanRecords = baseMapper.selectOne(queryWrapper); List<SCleanRecords> sCleanRecords = baseMapper.selectList(queryWrapper);
if(sCleanRecords == null){ if (CollectionUtils.isEmpty(sCleanRecords)) {
throw new RuntimeException("当前用户没有保洁任务"); throw new RuntimeException("当前用户没有保洁任务");
} }
sCleanRecords.setsRoom(sRoomMapper.selectById(sCleanRecords.getRoomId())); //取创建时间最远的
sCleanRecords.setsStore(sStoreMapper.selectById(sCleanRecords.getStoreId())); SCleanRecords records = sCleanRecords.stream().min(Comparator.comparing(SCleanRecords::getCreateTime)).get();
return sCleanRecords; records.setsRoom(sRoomMapper.selectById(records.getRoomId()));
records.setsStore(sStoreMapper.selectById(records.getStoreId()));
return records;
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment