* Fix sql for dmdb.

This commit is contained in:
朱金勇
2023-04-05 14:18:24 +00:00
parent 0f6b78f264
commit 7f9d638d28
20 changed files with 76 additions and 51 deletions
+4 -4
View File
@@ -1590,13 +1590,13 @@ class executionModel extends model
/* Waterfall execution, when all phases are closed, in reverse order of date. */
if(in_array($executionModel, array('waterfall', 'waterfallplus')))
{
$summary = $this->dao->select('count(id) as executions, sum(IF(INSTR("closed", status) < 1, 0, 1)) as closedExecutions')->from(TABLE_EXECUTION)->where('project')->eq($projectID)->andWhere('deleted')->eq('0')->fetch();
$summary = $this->dao->select("count(id) as executions, sum(IF(INSTR('closed', status) < 1, 0, 1)) as closedExecutions")->from(TABLE_EXECUTION)->where('project')->eq($projectID)->andWhere('deleted')->eq('0')->fetch();
if($summary->executions == $summary->closedExecutions) $orderBy = 'sortStatus_asc,begin_desc,id_asc';
}
}
/* Order by status's content whether or not done */
$executions = $this->dao->select('*, IF(INSTR("done,closed", status) < 2, 0, 1) AS isDone, INSTR("doing,wait,suspended,closed", status) AS sortStatus')->from(TABLE_EXECUTION)
$executions = $this->dao->select("*, IF(INSTR('done,closed', status) < 2, 0, 1) AS isDone, INSTR('doing,wait,suspended,closed', status) AS sortStatus")->from(TABLE_EXECUTION)
->where('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->beginIF(!$this->session->multiple and $this->app->tab == 'execution')->andWhere('multiple')->eq('1')->fi()
@@ -1727,7 +1727,7 @@ class executionModel extends model
}
else
{
return $this->dao->select('*, IF(INSTR(" done,closed", status) < 2, 0, 1) AS isDone')->from(TABLE_EXECUTION)
return $this->dao->select("*, IF(INSTR(' done,closed', status) < 2, 0, 1) AS isDone")->from(TABLE_EXECUTION)
->where('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->beginIF($type == 'all')->andWhere('type')->in('sprint,stage,kanban')->fi()
@@ -1777,7 +1777,7 @@ class executionModel extends model
}
else
{
return $this->dao->select('t1.*, IF(INSTR(" done,closed", t1.status) < 2, 0, 1) AS isDone')->from(TABLE_EXECUTION)->alias('t1')
return $this->dao->select("t1.*, IF(INSTR(' done,closed', t1.status) < 2, 0, 1) AS isDone")->from(TABLE_EXECUTION)->alias('t1')
->leftJoin(TABLE_TEAM)->alias('t2')->on('t2.root=t1.id')
->where('t1.deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()