mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat: 完善curd生成控制器时,自动开启关联查询配置
This commit is contained in:
@@ -1092,6 +1092,8 @@ class BuildCurdServiceBase
|
||||
protected function renderController()
|
||||
{
|
||||
$controllerFile = "{$this->rootDir}app{$this->DS}admin{$this->DS}controller{$this->DS}{$this->controllerFilename}.php";
|
||||
|
||||
$relationSearch = '';
|
||||
if (empty($this->relationArray)) {
|
||||
$controllerIndexMethod = '';
|
||||
$controllerExportMethod = '';
|
||||
@@ -1116,6 +1118,10 @@ class BuildCurdServiceBase
|
||||
'relationIndexMethod' => trim($relationCode),
|
||||
]
|
||||
);
|
||||
|
||||
$relationSearch = $this->replaceTemplate(
|
||||
$this->getTemplate("controller{$this->DS}relationSearch")
|
||||
);
|
||||
}
|
||||
$selectList = '';
|
||||
|
||||
@@ -1137,6 +1143,7 @@ class BuildCurdServiceBase
|
||||
'indexMethod' => $controllerIndexMethod,
|
||||
'exportMethod' => $controllerExportMethod,
|
||||
'selectList' => $selectList,
|
||||
'relationSearch' => $relationSearch,
|
||||
]
|
||||
);
|
||||
$this->fileList[$controllerFile] = $controllerValue;
|
||||
|
||||
@@ -13,6 +13,8 @@ use think\App;
|
||||
class {{controllerName}} extends AdminController
|
||||
{
|
||||
|
||||
{{relationSearch}}
|
||||
|
||||
use \app\admin\traits\Curd;
|
||||
|
||||
public function __construct(App $app)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 是否关联查询.
|
||||
* @var bool
|
||||
*/
|
||||
protected $relationSearch = true;
|
||||
Reference in New Issue
Block a user