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