修改生成代码模型主键错误问题

This commit is contained in:
liaofei 2023-04-23 10:27:51 +08:00
parent 269b100715
commit fa15a01ac2
2 changed files with 4 additions and 3 deletions

View File

@ -36,8 +36,9 @@ class {%nameCamel%} extends BaseModel
protected $name = '{%name%}';
/**
* 主键
* @var string
*/
protected $key = '{%key%}';
protected $pk = '{%key%}';
}

View File

@ -7,7 +7,7 @@
public function getCrudListIndex(array $where = [])
{
[$page, $limit] = $this->getPageValue();
$model = $this->dao->selectModel($where, '*', $page ?: 1, $limit ?: 10, '{%key%} desc');
$model = $this->dao->selectModel($where, '*', 0, 0, '{%key%} desc');
return ['count' => $model->count(), 'list' => $model->select()->toArray()];
return ['count' => $model->count(), 'list' => $model->page($page ?: 1, $limit ?: 10)->select()->toArray()];
}