Bläddra i källkod

报表排序优化

wufeng 2 år sedan
förälder
incheckning
9fb368da9c
1 ändrade filer med 10 tillägg och 2 borttagningar
  1. 10 2
      app/admin/controller/Report.php

+ 10 - 2
app/admin/controller/Report.php

@@ -406,7 +406,7 @@ class Report extends Base
             ->leftJoin('company_item ci', 'ci.id=du.itemid')
             ->where($where)
             ->group('addtime,du.itemid,ci.name ,cb.createrid,du.nickname')
-            ->order('addtime,du.itemid,ci.name ,cb.createrid,du.nickname')
+            ->order('addtime desc,du.itemid,ci.name ,cb.createrid,du.nickname')
             ->page($param['page'], $param['size'])
             ->select()
             ->toArray();
@@ -453,7 +453,7 @@ class Report extends Base
             ->alias('a')
             ->field('a.addtime,a.cgder_id,a.cgder,SUM(a.total_fee) total_fee,SUM(a.good_num) good_num,COUNT(a.id) count_num,a.status,0 wait_total_fee,0 wait_good_num')
             ->group('a.addtime,a.cgder_id,a.cgder,a.status')
-            ->order('a.addtime,a.cgder_id')
+            ->order('a.addtime desc,a.cgder_id')
             ->page($param['page'], $param['size'])
             ->cursor();
 
@@ -961,6 +961,7 @@ class Report extends Base
                 return isset($all_status[$val]) ? $all_status[$val] : $val;
             })
             ->page($param['page'], $param['size'])
+            ->order('or.addtime desc')
             ->select()
             ->toArray();
 
@@ -1002,6 +1003,7 @@ class Report extends Base
             ->withAttr('售后状态', function ($val) use ($all_status) {
                 return isset($all_status[$val]) ? $all_status[$val] : $val;
             })
+            ->order('or.addtime desc')
             ->select()
             ->toArray();
 
@@ -1064,6 +1066,7 @@ class Report extends Base
             ->withAttr('company_name', function ($val, $data) {
                 return get_company_name_by_uid($data['createrid']);
             })
+            ->order('s.addtime desc')
             ->select()
             ->toArray();
 
@@ -1103,6 +1106,7 @@ class Report extends Base
             ->alias('s')
             ->field('s.addtime 录入供应商时间,s.name 供应商名称,s.creater 采购维护人,"" 采购维护人所属部门,s.nature 供应商性质,s.source 供应商来源,s.pay_type 付款方式,s.delivery_way 发货方式,s.updatetime 修改供应商时间,s.createrid')
             ->where($where)
+            ->order('s.addtime desc')
             ->cursor();
 
         $data = [];
@@ -1162,6 +1166,7 @@ class Report extends Base
             ->leftJoin('good_basic gb', 'gb.spuCode=po.spuCode AND gb.is_del=0')
             ->leftJoin('result_info ri', 'ri.result_code=s.error_code AND ri.is_del=0')
             ->page($param['page'], $param['size'])
+            ->order('s.addtime desc')
             ->cursor();
 
         $data = [];
@@ -1203,6 +1208,7 @@ class Report extends Base
             ->leftJoin('purchease_order po', 'po.cgdNo=on.cgdNo')
             ->leftJoin('good_basic gb', 'gb.spuCode=po.spuCode AND gb.is_del=0')
             ->leftJoin('result_info ri', 'ri.result_code=s.error_code AND ri.is_del=0')
+            ->order('s.addtime desc')
             ->cursor();
 
         $data = [];
@@ -1261,6 +1267,7 @@ class Report extends Base
             ->leftJoin('good_basic gb', 'gb.spuCode=gp.spuCode AND gb.is_del=0')
             ->leftJoin('brand b', 'b.id=gb.brand_id')
             ->leftJoin('supplier s', 's.code=gb.supplierNo')
+            ->order('gp.updatetime desc')
             ->page($param['page'], $param['size'])
             ->cursor();
 
@@ -1315,6 +1322,7 @@ class Report extends Base
             ->leftJoin('good_basic gb', 'gb.spuCode=gp.spuCode AND gb.is_del=0')
             ->leftJoin('brand b', 'b.id=gb.brand_id')
             ->leftJoin('supplier s', 's.code=gb.supplierNo')
+            ->order('gp.updatetime desc')
             ->cursor();
 
         $data = [];