Merge branch 'master' of http://124.223.211.244:8418/zianxin/biz-api-cloud
This commit is contained in:
commit
f122598825
3 files changed
+22
-1
No files matched your search
@@ -35,3 +35,4 @@ create database `pjcloudx_erp` default character set utf8mb4 collate utf8mb4_gen
|
||||
create database `pjcloudx_supermarket` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_supermarket_erp` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_hardware` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
+3
@@ -79,4 +79,7 @@ public class ADCanteenSpuListVO {
|
||||
private Long deptId;
|
||||
|
||||
|
||||
|
||||
@Schema(description="餐段类型")
|
||||
private String categoryType;
|
||||
}
|
||||
+18
-1
@@ -7,9 +7,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenDailySpuDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenOnlineSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenCategoryMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenSpuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
@@ -25,7 +27,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 菜品spu
|
||||
@@ -39,6 +43,7 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
|
||||
|
||||
private final CanteenDailyMenuMapper canteenDailyMenuMapper;
|
||||
private final CanteenCategoryMapper canteenCategoryMapper;
|
||||
@Override
|
||||
public Object selectFoodList(LambdaQueryWrapper<CanteenSpuEntity> wrapper) {
|
||||
return baseMapper.selectListByScope(wrapper, DataScope.of());
|
||||
@@ -72,9 +77,21 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
public R getCanteenSpuList(String categoryId) {
|
||||
List<CanteenSpuEntity> canteenSpuEntities = baseMapper.selectListByScope(new LambdaQueryWrapper<CanteenSpuEntity>()
|
||||
.eq(StringUtils.isNotEmpty(categoryId), CanteenSpuEntity::getCategoryId, categoryId), DataScope.of());
|
||||
if (CollectionUtils.isEmpty(canteenSpuEntities)) {
|
||||
return R.ok(null);
|
||||
}
|
||||
List<Long> cIds = canteenSpuEntities.stream().map(canteenSpuEntity -> canteenSpuEntity.getCategoryId()).distinct().collect(Collectors.toList());
|
||||
List<ADCanteenSpuListVO> bean = BeanUtils.toBean(canteenSpuEntities, ADCanteenSpuListVO.class);
|
||||
return R.ok(bean);
|
||||
|
||||
List<CanteenCategoryEntity> canteenCategoryEntities = canteenCategoryMapper.selectList(new LambdaQueryWrapper<CanteenCategoryEntity>().in(CanteenCategoryEntity::getId, cIds));
|
||||
Map<Long, List<CanteenCategoryEntity>> listMap = canteenCategoryEntities.stream().collect(Collectors.groupingBy(CanteenCategoryEntity::getId));
|
||||
|
||||
bean.forEach(item -> {
|
||||
if (null!=listMap.get(item.getCategoryId()).get(0).getCategoryType()){
|
||||
item.setCategoryType(listMap.get(item.getCategoryId()).get(0).getCategoryType());
|
||||
}
|
||||
});
|
||||
return R.ok(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user