订单金额统计问题
订单列表展示 订单状态为退单且订单类型不为退单的 由前端展示成已完成
This commit is contained in:
@@ -33,10 +33,10 @@ import java.util.List;
|
||||
**/
|
||||
public interface TbOrderInfoRepository extends JpaRepository<TbOrderInfo, Integer>, JpaSpecificationExecutor<TbOrderInfo> {
|
||||
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.amount)) " +
|
||||
@Query("SELECT new cn.ysk.cashier.vo.TbOrderPayCountVo(info.payType, SUM(info.orderAmount)) " +
|
||||
"FROM TbOrderInfo info " +
|
||||
"WHERE info.shopId = :shopId " +
|
||||
"AND info.status ='closed'" +
|
||||
"AND ((info.status = 'closed') OR (info.status = 'refund' AND info.orderType != 'return')) " +
|
||||
"GROUP BY info.payType")
|
||||
List<TbOrderPayCountVo> queryTbOrderPayCount(@Param("shopId")String shopId);
|
||||
|
||||
|
||||
@@ -71,9 +71,10 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||
// Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
||||
Predicate predicate = QueryHelp.getPredicate(root, criteria, criteriaBuilder);
|
||||
// 追加校验参数 status不为空时 不查询状态为 "refund" 的
|
||||
if(StringUtils.isBlank(criteria.getStatus())){
|
||||
// 追加校验参数 status为空且source为空 时 不查询状态为 "refund"且orderType为return 的
|
||||
if (StringUtils.isBlank(criteria.getStatus()) && StringUtils.isBlank(criteria.getSource())) {
|
||||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.notEqual(root.get("status"), "refund"));
|
||||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.notEqual(root.get("orderType"), "return"));
|
||||
}
|
||||
return predicate;
|
||||
}, pageable);
|
||||
|
||||
Reference in New Issue
Block a user