diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java index 42e89ea5..3cc1cf23 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java @@ -22,6 +22,9 @@ public class BusinessStatisticsQuery { @ApiModelProperty("商户ID") private Long mchId; + @ApiModelProperty("合伙人ID") + private Long staffId; + @ApiModelProperty("店铺ID") private Long storeId; diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml index cf6ea82f..f80355ce 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml @@ -29,6 +29,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sm_device sd on sd.device_id = stb.device_id <where> <if test="mchId != null">and stb.mch_id = #{mchId}</if> + <if test="staffId != null"> + and ss.store_id in ( + select distinct sss.store_id + from ss_store_staff sss + where sss.user_id = #{staffId} + ) + </if> <!--店铺id=-1时,查询未分配店铺的数据--> <if test="storeId != null and storeId == -1">and stb.store_id is null</if> <if test="storeId != null and storeId != -1">and stb.store_id = #{storeId}</if> diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/staff/StaffDashboardController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/staff/StaffDashboardController.java index d1884def..ad438127 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/staff/StaffDashboardController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/staff/StaffDashboardController.java @@ -1,8 +1,12 @@ package com.ruoyi.web.controller.staff; import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.dashboard.domain.dto.BusinessStatisticsQuery; import com.ruoyi.dashboard.service.DashboardService; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -18,4 +22,19 @@ public class StaffDashboardController extends BaseController { @Autowired DashboardService dashboardService; + @ApiOperation("合伙人获取店铺维度的订单统计") + @GetMapping("/businessStatisticsByStore") + public AjaxResult businessStatisticsByStore(BusinessStatisticsQuery query) { + query.setStaffId(getUserId()); + return success(dashboardService.businessStatisticsByStore(query)); + } + + @ApiOperation("合伙人获取指定店铺的订单统计") + @GetMapping("/businessStatisticsByDevice") + public AjaxResult businessStatisticsByDevice(BusinessStatisticsQuery query) { + query.setStaffId(getUserId()); + return success(dashboardService.businessStatisticsByDevice(query)); + } + + }