* Fix order in dmdb.

This commit is contained in:
朱金勇
2023-04-10 03:13:24 +00:00
parent 9bc7941349
commit 75a3485f47
7 changed files with 23 additions and 9 deletions
+2 -2
View File
@@ -966,8 +966,8 @@ CREATE TABLE IF NOT EXISTS `zt_kanbanregion` (
`order` mediumint(8) NOT NULL DEFAULT '0',
`createdBy` char(30) NOT NULL,
`createdDate` datetime NOT NULL,
`lastEditedBy` char(30) NOT NULL,
`lastEditedDate` datetime NOT NULL,
`lastEditedBy` char(30) NOT NULL DEFAULT '',
`lastEditedDate` datetime NULL,
`deleted` enum('0', '1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+14
View File
@@ -217,6 +217,20 @@ class dm extends dao
return parent::groupBy($groupBy);
}
/**
* 创建ORDER BY部分。
* Create the order by part.
*
* @param string $order
* @access public
* @return static|sql the sql object.
*/
public function orderBy($order)
{
$order = str_replace('"', '', $order);
return parent::orderBy($order);
}
/**
* 创建ON部分。
* Create the on part.
+1
View File
@@ -256,6 +256,7 @@ class dbh
public function formatDmSQL($sql)
{
$sql = trim($sql);
$sql = str_replace(array('\r', '\n'), ' ', $sql);
$actionPos = strpos($sql, ' ');
$action = strtoupper(substr($sql, 0, $actionPos));
$setPos = 0;
+1 -1
View File
@@ -919,7 +919,7 @@ class bug extends control
$projects = $this->loadModel('product')->getProjectPairsByProduct($productID, $bug->branch);
$this->session->set("project", key($projects), 'project');
$this->executeHooks($bugID);
/* Header and positon. */
+2 -3
View File
@@ -238,14 +238,13 @@ class projectModel extends model
->groupBy('t1.root')
->fetchAll('root');
$condition = 't2.project as project';
$estimates = $this->dao->select("$condition, sum(estimate) as estimate")->from(TABLE_TASK)->alias('t1')
$estimates = $this->dao->select("t2.project as project, sum(estimate) as estimate")->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
->where('t1.parent')->lt(1)
->andWhere('t2.project')->in($projectIdList)
->andWhere('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->groupBy('project')
->groupBy('t2.project')
->fetchAll('project');
$this->app->loadClass('pager', $static = true);
+2 -2
View File
@@ -1469,7 +1469,7 @@ class repo extends control
}
}
$latestInDB = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
$latestInDB = $this->dao->select('t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->beginIF($repo->SCM == 'Git' and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
@@ -1538,7 +1538,7 @@ class repo extends control
$this->repo->setRepoBranch($branch);
setcookie("syncBranch", $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, true);
$latestInDB = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
$latestInDB = $this->dao->select('t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->beginIF(in_array($repo->SCM, $this->config->repo->gitTypeList) and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
+1 -1
View File
@@ -780,7 +780,7 @@ class repoModel extends model
->beginIF($begin)->andWhere('t1.time')->ge($begin)->fi()
->beginIF($end)->andWhere('t1.time')->le($end)->fi()
->orderBy('time desc');
if($entry == '/' or empty($entry))$comments->page($pager, 't1.id');
if($entry == '/' or empty($entry)) $comments->page($pager, 't1.id');
$comments = $comments->fetchAll('revision');
foreach($comments as $repoComment)