sayid / table2model
Installs: 78
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sayid/table2model
Requires
- php: >=7.3
This package is auto-updated.
Last update: 2025-09-29 02:50:06 UTC
README
第一步:安装
"sayid/phibatis" : "dev-master"
第二步:
config/mybatis.php
中配置
```
return [
"namespace" => "App\Entities\Base", //生成类的命名空间
"output" => app()->basePath("app/Entities/Base"), //生成类输出到什么地方
"tables" => [
["table" => "user", "PriKey" => "user_id", "EntityName" => "User"],//table=表名 PriKey=主键 EntityName=实体类名称
['table'=>'memorial_member', "PriKey" => "id", "EntityName" => "Memorial"],
['table'=>'tribute', "PriKey" => "id", "EntityName" => "Tribute"],
]
];
```
第三步:
执行vendor/bin/mybatis
自动生成entity类和example类
第四步: 编写业务逻辑
$userExample = new UserExample(); $data = $userExample->andUserIdGt(0)->andAvatarNotEQ(0)->getList(); echo $userExample->getBuilder()->toSql(); var_dump($data);