Browse Source

fix(statistics): 更新部门销售额排行查询逻辑

- 修改接口注释描述为“管理端首页获取部门售额排行”- 调整SQL查询字段引用方式,明确指定表别名opi- 优化排序逻辑,确保按quantity和price正确降序排列
SheepHy 4 weeks ago
parent
commit
c4962b5214

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/StatisticsController.java

@@ -40,7 +40,7 @@ public class StatisticsController {
      *
      */
     @GetMapping("/findByDeptSum")
-    @Operation(summary = "管理端首页获取商品销量排行")
+    @Operation(summary = "管理端首页获取部门售额排行")
     public Result<List<Map<String, Object>>> findByDeptSum(int type){
         return Result.ok(statisticsService.findByDeptSum(type));
     }

+ 3 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/StatisticsMapper.xml

@@ -4,9 +4,9 @@
     <select id="findByShopSum" resultType="map">
         SELECT
             product_name,
-            SUM(quantity) AS total_quantity,
-            SUM(price) AS total_price,
-            ROW_NUMBER() OVER (ORDER BY SUM(quantity) DESC, SUM(price) DESC) AS ranking
+            SUM(opi.quantity) AS total_quantity,
+            SUM(opi.price) AS total_price,
+            ROW_NUMBER() OVER (ORDER BY SUM(opi.quantity) DESC, SUM(opi.price) DESC) AS ranking
         FROM nm_order_pro_info opi
                  JOIN nm_order o ON opi.order_code = o.order_code
                  JOIN nm_site s ON o.org_code = s.org_code