wzh il y a 5 ans
Parent
commit
664748bffa
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      api/application/controllers/Project.php

+ 4 - 2
api/application/controllers/Project.php

@@ -438,8 +438,8 @@ class Project extends Base_Controller {
 
             // $data = $this->Project_model->get_list($where, 'projectname,id,lampcount',NULL, NULL, 'convert(projectname using gbk) asc', NUll);
             $join = array();
-            $join = ['table'=>'project as P','cond'=>'L.projectid = P.id','type'=>'left'];
-            $data = $this->Lamp_model->get_list_by_join($where, 'P.projectname,P.id,count(L.id) as lampcount',NULL, NULL, $join, 'convert(projectname using gbk) asc', 'L.projectid', 'L');
+            $join = ['table'=>'lampinfo as L','cond'=>'L.projectid = P.id','type'=>'left'];
+            $data = $this->Project_model->get_list_by_join($where, 'P.projectname,P.id,count(L.id) as lampcount',NULL, NULL, $join, 'convert(projectname using gbk) asc', 'L.projectid', 'P');
             if (!empty($data)) {
                 $temp = array();
                 foreach ($data as $key => $value) {
@@ -448,6 +448,8 @@ class Project extends Base_Controller {
                 }
                 $projectIdArr = array_column($data, 'id');
                 $sectionWhere['L.projectid'] = $projectIdArr;
+                $join = array();
+                $join = ['table'=>'project as P','cond'=>'L.projectid = P.id','type'=>'left'];
                 $sectionList = $this->Lamp_model->get_list_by_join($sectionWhere, 'L.section as name,L.projectid,count(*) as lampcount',NULL, NULL,$join, 'convert(L.section using gbk) asc', 'L.projectid,L.section','L');
                 foreach ($sectionList as $key => $value) {
                     if (isset($temp[$value['projectid']])) {