8000 fix · laraveladmin-cn/laraveladmin@da7ad81 · GitHub
[go: up one dir, main page]

Skip to content

Commit da7ad81

Browse files
author
张世平
committed
fix
1 parent 94f583e commit da7ad81

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

app/Http/Controllers/Traits/ResourceController.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,9 @@ protected function existFullTextSearch(){
361361
return $this->hasFullTextSearch;
362362
}
363363

364-
/**
365-
* 获取翻页数据
366-
*/
367-
public function getList()
368-
{
369-
$this->selectValidate();
370-
$this->bindModel = $this->bindModel();
364+
protected function selectIndexFields(&$query,&$fields=[],&$primary_key=''){
371365
//指定查询字段
372-
$fields = $this->selectFields($this->showIndexFields,$this->bindModel);
366+
$fields = $this->selectFields($this->showIndexFields,$query);
373367
//判断是否包含主键字段,没有包含自动添加
374368
$model = $this->newBindModel();
375369
$primary_key = $model->getKeyName();
@@ -388,9 +382,22 @@ public function getList()
388382
}
389383
$hasFullTextSearch = $this->existFullTextSearch();
390384
if($fields && !$hasFullTextSearch){
391-
$this->bindModel = $this->bindModel->select($fields);
385+
$query = $query->select($fields);
392386
}
387+
return $query;
388+
}
393389

390+
/**
391+
* 获取翻页数据
392+
*/
393+
public function getList()
394+
{
395+
$this->selectValidate();
396+
$this->bindModel = $this->bindModel();
397+
$primary_key = '';
398+
$fields = [];
399+
$hasFullTextSearch = $this->existFullTextSearch();
400+
$this->bindModel = $this->selectIndexFields($this->bindModel,$fields,$primary_key);
394401
//获取带有筛选条件的对象
395402
$obj = $this->getWithOptionModel();
396403
$obj = $this->handleList($obj);

0 commit comments

Comments
 (0)
0