From 097e46e889ae50e0b603bc9cf727b6f3fe8e67e9 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 6 Jan 2025 15:29:32 +0800 Subject: [PATCH] * [bug#55858,done,2.5h] fix order error. --- module/story/control.php | 1 - module/transfer/model.php | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 85ae0ff875..d096b709f3 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -1938,7 +1938,6 @@ class story extends control $this->config->story->dtable->fieldList['plan']['dataSource'] = array('module' => 'productplan', 'method' => 'getPairs', 'params' => array($productIdList)); } - $this->post->set('rows', $this->story->getExportStories($orderBy, $storyType, $postData)); $this->fetch('transfer', 'export', "model=$storyType"); } diff --git a/module/transfer/model.php b/module/transfer/model.php index 7099fb5e9f..5312d41e51 100644 --- a/module/transfer/model.php +++ b/module/transfer/model.php @@ -647,6 +647,7 @@ class transferModel extends model $checkedItem = $this->post->checkedItem ? $this->post->checkedItem : $this->cookie->checkedItem; $onlyCondition = $this->session->{$module . 'OnlyCondition'}; $queryCondition = $this->session->{$module . 'QueryCondition'}; + $orderBy = $this->session->{$module . 'OrderBy'}; /* 插入用例场景数据。*/ /* Fetch the scene's cases. */ @@ -673,6 +674,7 @@ class transferModel extends model } $moduleDatas = $sql->where($queryCondition) ->beginIF($this->post->exportType == 'selected')->andWhere('t1.id')->in($checkedItem)->fi() + ->beginIF($orderBy)->orderBy($orderBy)->fi() ->fetchAll('id', false); } elseif($queryCondition) @@ -685,7 +687,7 @@ class transferModel extends model preg_match_all('/[`"]' . $this->config->db->prefix . $module .'[`"] AS ([\w]+) /', $queryCondition, $matches); if(isset($matches[1][0])) $selectKey = "{$matches[1][0]}.id"; - $stmt = $this->dbh->query($queryCondition . ($this->post->exportType == 'selected' ? " AND $selectKey IN(" . ($checkedItem ? $checkedItem : '0') . ")" : '')); + $stmt = $this->dbh->query($queryCondition . ($this->post->exportType == 'selected' ? " AND $selectKey IN(" . ($checkedItem ? $checkedItem : '0') . ")" : '') . ($orderBy ? " ORDER BY $orderBy" : '')); while($row = $stmt->fetch()) { if($selectKey !== 't1.id' and isset($row->$module) and isset($row->id)) $row->id = $row->$module;