Commit 0184db76 by 吕明尚

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

parent d981eb90
......@@ -296,13 +296,15 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SCleanRecords::getConsumerId,user.getId());
queryWrapper.in(SCleanRecords::getStatus, CleaningStatusEnum.CLEANING.getCode());
SCleanRecords sCleanRecords = baseMapper.selectOne(queryWrapper);
if(sCleanRecords == null){
List<SCleanRecords> sCleanRecords = baseMapper.selectList(queryWrapper);
if (CollectionUtils.isEmpty(sCleanRecords)) {
throw new RuntimeException("当前用户没有保洁任务");
}
sCleanRecords.setsRoom(sRoomMapper.selectById(sCleanRecords.getRoomId()));
sCleanRecords.setsStore(sStoreMapper.selectById(sCleanRecords.getStoreId()));
return sCleanRecords;
//取创建时间最远的
SCleanRecords records = sCleanRecords.stream().min(Comparator.comparing(SCleanRecords::getCreateTime)).get();
records.setsRoom(sRoomMapper.selectById(records.getRoomId()));
records.setsStore(sStoreMapper.selectById(records.getStoreId()));
return records;
}
@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