|
@@ -193,4 +193,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
return goodsMap;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取商品的订单量以及交易金额
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Map<String,Object>> getGoodsAmount(){
|
|
|
+ Long userId = SessionContextHolder.getId();
|
|
|
+ Scope scope = StringUtils.ifEmpty(SessionContextHolder.getScope(), Scope::parse);
|
|
|
+ if (scope == Scope.ADMIN) {
|
|
|
+ return this.baseMapper.getGoodsAmount(null);
|
|
|
+ }else {
|
|
|
+ List<Long> merchants = this.merchantService.getMerchantIdsByUserId(userId);
|
|
|
+ if (ObjectUtils.isEmpty(merchants)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return this.baseMapper.getGoodsAmount(merchants.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|