refactor(curd): improve relation handling and query methods

- Replace with() with withJoin() for more efficient left joins
- Fix foreign key and primary key assignments in relations
- Update index page queries to use relation index method-Modify relation method generation in model to use belongsTo instead of hasOne- Adjust table column definitions for relation fields
This commit is contained in:
wolfcode
2025-04-17 17:25:06 +08:00
parent d1dfa8b49b
commit 517fd191d3
3 changed files with 7 additions and 8 deletions

View File

@@ -7,7 +7,7 @@
return $this->selectList();
}
list($page, $limit, $where) = $this->buildTableParams();
$count = self::$model::where($where)->count();
$count = self::$model::where($where)->{{relationIndexMethod}}->count();
$list = self::$model::where($where)->{{relationIndexMethod}}->page($page, $limit)->order($this->sort)->select()->toArray();
$data = [
'code' => 0,