* Finish task #66938.

This commit is contained in:
liumengyi
2022-08-29 11:07:47 +08:00
parent 7e60d43f6e
commit 6db1eac73f
+10 -6
View File
@@ -219,9 +219,11 @@ class projectModel extends model
if(empty($projects)) return array();
$projectIdList = array_keys($projects);
$teams = $this->dao->select('root, count(*) as count')->from(TABLE_TEAM)
->where('root')->in($projectIdList)
->groupBy('root')
$teams = $this->dao->select('t1.root, count(t1.id) as count')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->where('t1.root')->in($projectIdList)
->andWhere('t2.deleted')->eq(0)
->groupBy('t1.root')
->fetchAll('root');
$condition = $this->config->systemMode == 'classic' ? 't2.id as project' : 't2.parent as project';
@@ -298,9 +300,11 @@ class projectModel extends model
if(empty($projects)) return array();
$projectIdList = array_keys($projects);
$teams = $this->dao->select('root, count(*) as teams')->from(TABLE_TEAM)
->where('root')->in($projectIdList)
->andWhere('type')->eq('project')
$teams = $this->dao->select('t1.root, count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->where('t1.root')->in($projectIdList)
->andWhere('t1.type')->eq('project')
->andWhere('t2.deleted')->eq(0)
->groupBy('root')->fetchPairs();
$hours = $this->dao->select('t2.parent as project, ROUND(SUM(t1.consumed), 1) AS consumed, ROUND(SUM(t1.estimate), 1) AS estimate')->from(TABLE_TASK)->alias('t1')