* [misc] fix sql.

This commit is contained in:
liyang
2025-10-11 16:37:07 +08:00
parent ad256e362f
commit 07aab251ca
5 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -621,7 +621,7 @@ class blockZen extends block
$this->view->projects = $this->loadModel('project')->getPairsByProgram();
$this->view->testtasks = $this->dao->select("DISTINCT t1.*,t2.name as productName,t2.shadow,t3.name as buildName,t4.name as projectName, CONCAT(t4.name, '/', t3.name) as executionBuild")->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=CAST(t3.id AS VARCHAR(20))')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=CAST(t3.id AS CHAR)')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.execution=t4.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.execution=t5.project')
->where('t1.deleted')->eq('0')
@@ -1572,7 +1572,7 @@ class blockZen extends block
$this->view->project = $this->loadModel('project')->getByID($this->session->project);
$this->view->testtasks = $this->dao->select("DISTINCT t1.*,t2.name as productName,t2.shadow,t3.name as buildName,t4.name as executionName, CONCAT(t4.name, '/', t3.name) as executionBuild")->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=CAST(t3.id AS VARCHAR(20))')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=CAST(t3.id AS CHAR)')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.execution=t4.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project')
->where('t1.deleted')->eq('0')
+1 -1
View File
@@ -775,7 +775,7 @@ class docModel extends model
public function getDocsOfLibs(array $libs, string $spaceType, int $excludeID = 0, $queryTemplate = false): array
{
$docs = $this->dao->select('t1.*')->from(TABLE_DOC)->alias('t1')
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=CAST(t2.id AS VARCHAR(20))')
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=CAST(t2.id AS CHAR)')
->where('t1.lib')->in($libs)
->andWhere('t1.vision')->eq($this->config->vision)
->beginIF(!$queryTemplate)->andWhere('t1.templateType')->eq('')->andWhere('t2.type')->eq('doc')->fi()
+1 -1
View File
@@ -113,7 +113,7 @@ class releaseModel extends model
$builds = $this->dao->select("t1.id, t1.name, t1.project, t1.execution, IF(t2.name IS NOT NULL, t2.name, '') AS projectName, IF(t3.name IS NOT NULL, t3.name, '{$this->lang->trunk}') AS branchName")
->from(TABLE_BUILD)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_BRANCH)->alias('t3')->on('t1.branch = CAST(t3.id AS VARCHAR(20))')
->leftJoin(TABLE_BRANCH)->alias('t3')->on('t1.branch = CAST(t3.id AS CHAR)')
->fetchAll('id');
$this->loadModel('branch');
+3 -3
View File
@@ -156,7 +156,7 @@ class testtaskModel extends model
{
$tasks = $this->dao->select('t1.*, t1.id AS idName, t5.multiple, IF(t4.shadow = 1, t5.name, t4.name) AS productName, t3.name AS executionName, t2.name AS buildName, t2.branch AS branch, t5.name AS projectName, t4.`order` AS productOrder')
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = CAST(t2.id AS VARCHAR(20))')
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = CAST(t2.id AS CHAR)')
->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id')
->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product = t4.id')
->leftJoin(TABLE_PROJECT)->alias('t5')->on('t3.project = t5.id')
@@ -187,7 +187,7 @@ class testtaskModel extends model
return $this->dao->select('t1.*, t2.name AS buildName, t3.name AS productName')
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = CAST(t2.id AS VARCHAR(20))')
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = CAST(t2.id AS CHAR)')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
->where('t1.deleted')->eq('0')
->beginIF($objectType == 'execution')->andWhere('t1.execution')->eq((int)$executionID)->fi()
@@ -313,7 +313,7 @@ class testtaskModel extends model
return $this->dao->select("t1.*, t2.name AS executionName, t2.multiple AS executionMultiple, t5.name AS projectName, t3.name AS buildName, t4.name AS productName, CONCAT(t2.name, '/', t3.name) as executionBuild")
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = CAST(t3.id AS VARCHAR(20))')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = CAST(t3.id AS CHAR)')
->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product = t4.id')
->leftJoin(TABLE_PROJECT)->alias('t5')->on('t2.project = t5.id')
->where('t1.deleted')->eq('0')
+1 -1
View File
@@ -25,7 +25,7 @@ class testtaskTao extends testtaskModel
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id')
->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = CAST(t4.id AS VARCHAR(20))')
->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = CAST(t4.id AS CHAR)')
->leftJoin(TABLE_PROJECT)->alias('t5')->on('t1.project = t5.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)