|
|
@@ -24,16 +24,19 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt |
|
|
|
return OrderShopInterface::class; |
|
|
|
} |
|
|
|
|
|
|
|
public function countValidOrderWithReductionCredit($reductionCredit, $user) |
|
|
|
public function countValidOrderWithReductionCredit($reductionCredit, $user=null) |
|
|
|
{ |
|
|
|
$query = $this->findByMerchantQuery(); |
|
|
|
$query = $this->filterOrderValid($query); |
|
|
|
$query->select('count(e.id)'); |
|
|
|
$query->andWhere('e.user = :user'); |
|
|
|
if($user) { |
|
|
|
$query->andWhere('e.user = :user'); |
|
|
|
$query->setParameter('user', $user); |
|
|
|
} |
|
|
|
$query->innerJoin('e.orderReductionCredits', 'orc'); |
|
|
|
$query->andWhere('orc.reductionCredit = :reductionCredit'); |
|
|
|
$query->setParameter('reductionCredit', $reductionCredit); |
|
|
|
$query->setParameter('user', $user); |
|
|
|
|
|
|
|
return $query->getQuery()->getSingleScalarResult(); |
|
|
|
} |
|
|
|
|