* Optimize execution drop-down speed.

This commit is contained in:
liumengyi
2023-08-10 13:55:01 +08:00
parent 61997cb191
commit 006c191a86
5 changed files with 60 additions and 37 deletions
+18 -20
View File
@@ -544,15 +544,13 @@ class programModel extends model
if($browseType == 'bySearch' and $this->session->projectQuery == false) $this->session->set('projectQuery', ' 1 = 1');
}
$query = str_replace('`id`','t1.id', $this->session->projectQuery);
$projectList = $this->dao->select('DISTINCT t1.*')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_TEAM)->alias('t2')->on('t1.id=t2.root')
->leftJoin(TABLE_STAKEHOLDER)->alias('t3')->on('t1.id=t3.objectID')
->where('t1.deleted')->eq('0')
$query = str_replace('`id`','t1.id', $this->session->projectQuery);
$stmt = $this->dao->select('DISTINCT t1.*')->from(TABLE_PROJECT)->alias('t1');
if($this->cookie->involved || $involved) $stmt->leftJoin(TABLE_TEAM)->alias('t2')->on('t1.id=t2.root')->leftJoin(TABLE_STAKEHOLDER)->alias('t3')->on('t1.id=t3.objectID');
$stmt->where('t1.deleted')->eq('0')
->andWhere('t1.vision')->eq($this->config->vision)
->beginIF($browseType == 'bysearch' and $query)->andWhere($query)->fi()
->andWhere('t1.type')->eq('project')
->beginIF($this->cookie->involved or $involved)->andWhere('t2.type')->eq('project')->fi()
->beginIF(!in_array($browseType, array('all', 'undone', 'bysearch', 'review', 'unclosed'), true))->andWhere('t1.status')->eq($browseType)->fi()
->beginIF($browseType == 'undone' or $browseType == 'unclosed')->andWhere('t1.status')->in('wait,doing')->fi()
->beginIF($browseType == 'review')
@@ -560,20 +558,20 @@ class programModel extends model
->andWhere('t1.reviewStatus')->eq('doing')
->fi()
->beginIF($path)->andWhere('t1.path')->like($path . '%')->fi()
->beginIF(!$queryAll and !$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->projects)->fi()
->beginIF($this->cookie->involved or $involved)
->andWhere('t1.openedBy', true)->eq($this->app->user->account)
->orWhere('t1.PM')->eq($this->app->user->account)
->orWhere('t2.account')->eq($this->app->user->account)
->orWhere('(t3.user')->eq($this->app->user->account)
->andWhere('t3.deleted')->eq(0)
->markRight(1)
->orWhere("CONCAT(',', t1.whitelist, ',')")->like("%,{$this->app->user->account},%")
->markRight(1)
->fi()
->orderBy($orderBy)
->page($pager, 't1.id')
->fetchAll('id');
->beginIF(!$queryAll and !$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->projects)->fi();
if($this->cookie->involved || $involved)
{
$stmt->andWhere('t2.type')->eq('project')
->andWhere('t1.openedBy', true)->eq($this->app->user->account)
->orWhere('t1.PM')->eq($this->app->user->account)
->orWhere('t2.account')->eq($this->app->user->account)
->orWhere('(t3.user')->eq($this->app->user->account)
->andWhere('t3.deleted')->eq(0)
->markRight(1)
->orWhere("CONCAT(',', t1.whitelist, ',')")->like("%,{$this->app->user->account},%")
->markRight(1);
}
$projectList = $stmt->orderBy($orderBy)->page($pager)->fetchAll('id');
/* Determine how to display the name of the program. */
if($programTitle and $this->config->systemMode == 'ALM')