feat(curd): add relation data binding and optimize model construction

- Add relation data binding in model construction
- Update model template to include new relation construction logic
- Remove unused index method template
This commit is contained in:
wolfcode
2024-12-20 16:26:56 +08:00
parent bbd0320a35
commit 5d58248cf4
3 changed files with 41 additions and 49 deletions

View File

@@ -1,23 +0,0 @@
/**
* @NodeAnnotation(title="列表")
*/
public function index()
{
if ($this->request->isAjax()) {
if (input('selectFields')) {
return $this->selectList();
}
list($page, $limit, $where) = $this->buildTableParams();
$count = $this->model{{relationIndexMethod}}->where($where)->count();
$list = $this->model{{relationIndexMethod}}->where($where)->page($page, $limit)->order($this->sort)->select()->toArray();
$data = [
'code' => 0,
'msg' => '',
'count' => $count,
'data' => $list,
];
return json($data);
}
return $this->fetch();
}