* code for task #71609.

This commit is contained in:
wangyidong
2022-10-10 09:08:28 +08:00
parent 059cf9a8af
commit a51f42e7b8
4 changed files with 19 additions and 49 deletions
+3 -11
View File
@@ -2595,11 +2595,11 @@ class taskModel extends model
{
if(!$this->loadModel('common')->checkField(TABLE_TASK, $type)) return array();
$orderBy = str_replace('pri_', 'priOrder_', $orderBy);
$tasks = $this->dao->select("t1.*, t2.id as executionID, t2.name as executionName, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
$tasks = $this->dao->select("t1.*, t4.id as project, t2.id as executionID, t2.name as executionName, t4.name as projectName, t2.multiple as executionMultiple, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on("t1.execution = t2.id")
->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
->leftJoin(TABLE_PROJECT)->alias('t4')->on("t1.project = t4.id")
->leftJoin(TABLE_PROJECT)->alias('t4')->on("t2.project = t4.id")
->leftJoin(TABLE_TASKTEAM)->alias('t5')->on("t5.task = t1.id and t5.account = '{$account}'")
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
@@ -2625,15 +2625,7 @@ class taskModel extends model
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', false);
$taskTeam = $this->dao->select('*')->from(TABLE_TASKTEAM)->where('task')->in(array_keys($tasks))->fetchGroup('task');
if(!empty($taskTeam))
{
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
}
$projectList = array();
foreach($tasks as $task) $projectList[$task->project] = $task->project;
$projectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectList)->fetchPairs('id');
foreach($tasks as $task) $task->projectName = zget($projectPairs, $task->project);
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
if($tasks) return $this->processTasks($tasks);
return array();