fix:食堂新增字段是否显示
This commit is contained in:
1 parent
8c60f30154
commit
42d40f0fd3
2 files changed
+24
-4
No files matched your search
+5
@@ -40,4 +40,9 @@ public class DailyMenuAppVO {
|
||||
private Integer hourType;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private String isShow;
|
||||
}
|
||||
+19
-4
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.vo.ADCanteenDailyMenuListVO;
|
||||
import com.bsd.pjcloud.canteen.vo.DailyMenuVO;
|
||||
@@ -48,6 +49,8 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
private final RemoteMqttEventService remoteMqttEventService;
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
private final CanteenSpuMapper canteenSpuMapper;
|
||||
|
||||
@Override
|
||||
public List<DailyMenuAll> selectTimeFood(String time, Long merchantId, Long categoryId) {
|
||||
List<DailyMenuAll> dailyMenuAllES = new ArrayList<>();
|
||||
@@ -145,16 +148,27 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.eq(CanteenDailyMenuEntity::getStartTime, dailyMenuDTO.getStartTime());
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.eq(dailyMenuDTO.getHourType() != null,
|
||||
CanteenDailyMenuEntity::getHourType, dailyMenuDTO.getHourType());
|
||||
|
||||
//查询
|
||||
LambdaQueryWrapper<CanteenSpuEntity> onlineFoodSpuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null != dailyMenuDTO.getCategoryId(), CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(CanteenSpuEntity::getIsShow, "1");
|
||||
List<CanteenSpuEntity> spuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(spuEntities)){
|
||||
List<Long> spuIds = spuEntities.stream().map(CanteenSpuEntity::getId).collect(Collectors.toList());
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.notIn(CanteenDailyMenuEntity::getSpuId, spuIds);
|
||||
}
|
||||
|
||||
Page pageData = baseMapper.selectPage(page, canteenDailyMenuEntityLambdaQueryWrapper);
|
||||
List<CanteenDailyMenuEntity> canteenDailyMenuEntities = pageData.getRecords();
|
||||
if (CollectionUtils.isNotEmpty(canteenDailyMenuEntities)) {
|
||||
List<Long> spuIds = canteenDailyMenuEntities.stream().map(CanteenDailyMenuEntity::getSpuId).distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CanteenSpuEntity> onlineFoodSpuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null != dailyMenuDTO.getCategoryId(), CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
LambdaQueryWrapper<CanteenSpuEntity> spuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.in(CanteenSpuEntity::getId, spuIds);
|
||||
List<CanteenSpuEntity> canteenSpuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
List<CanteenSpuEntity> list = canteenSpuService.list(spuDOLambdaQueryWrapper);
|
||||
// 按 id 分组成 Map
|
||||
Map<Long, CanteenSpuEntity> spuEntityMap = canteenSpuEntities.stream()
|
||||
Map<Long, CanteenSpuEntity> spuEntityMap = list.stream()
|
||||
.collect(Collectors.toMap(CanteenSpuEntity::getId, spu -> spu));
|
||||
// 构造新的 VO 列表
|
||||
List<DailyMenuAppVO> dailyMenuVOList = canteenDailyMenuEntities.stream()
|
||||
@@ -169,6 +183,7 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
vo.setPicUrl(spuEntity.getPicUrl());
|
||||
vo.setName(spuEntity.getName());
|
||||
vo.setSort(spuEntity.getSort());
|
||||
vo.setIsShow(spuEntity.getIsShow());
|
||||
// 其他需要的字段
|
||||
}
|
||||
return vo;
|
||||
|
||||
Reference in new issue
Block a user