|
@@ -171,17 +171,20 @@ public class DetailServiceImpl implements IDetailService {
|
|
|
PlaceInfoVO.PlaceInfoMsgVO placeInfoMsgVO = new PlaceInfoVO.PlaceInfoMsgVO();
|
|
|
// 1. 先获取所有符合条件的订单ID列表(单次查询)
|
|
|
List<String> orderIdList = appOrderMapper.selectList(Wrappers.<AppOrder>lambdaQuery()
|
|
|
- .select(AppOrder::getId) // 仅查询ID字段
|
|
|
+ .select(AppOrder::getId)
|
|
|
.eq(AppOrder::getOrgCode, appSitePlace.getOrgCode())
|
|
|
.eq(AppOrder::getType, 0)
|
|
|
.eq(AppOrder::getOrderType, 0))
|
|
|
.stream()
|
|
|
- .map(order -> order.getId().toString()) // 假设getId()返回Long
|
|
|
+ .map(order -> order.getId().toString())
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- // 2. 使用ID列表直接统计关联记录(单次查询)
|
|
|
- int salesCount = Math.toIntExact(appOrderProInfoMapper.selectCount(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
|
- .in(AppOrderProInfo::getOrderId, orderIdList)));
|
|
|
+ // 2. 判断空集合
|
|
|
+ int salesCount = 0;
|
|
|
+ if (!orderIdList.isEmpty()) {
|
|
|
+ salesCount = Math.toIntExact(appOrderProInfoMapper.selectCount(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
|
+ .in(AppOrderProInfo::getOrderId, orderIdList)));
|
|
|
+ }
|
|
|
placeInfoMsgVO.setName(appSitePlace.getName())
|
|
|
.setId(appSitePlace.getId())
|
|
|
.setCategory(getCategoryName(appSite.getCategoryId()))
|