Commit b140b9a7 by feixiang

生成dao,data,变量名修改

parent 8c522818
...@@ -20,13 +20,13 @@ class {className} ...@@ -20,13 +20,13 @@ class {className}
public function create(array $info) : {entityName} public function create(array $info) : {entityName}
{ {
${entityName} = new {entityName}($info); ${varEntityName} = new {entityName}($info);
$res = ${entityName}->save()->getResult(); $res = ${varEntityName}->save()->getResult();
if ( $res === false ) { if ( $res === false ) {
throw new CommonException(["msg" => "数据库操作错误", "code" => 500]); throw new CommonException(["msg" => "数据库操作错误", "code" => 500]);
} }
return ${entityName}; return ${varEntityName};
} }
public function selectInfoByCondition($condition, $field) public function selectInfoByCondition($condition, $field)
......
...@@ -23,6 +23,6 @@ class {dataName} ...@@ -23,6 +23,6 @@ class {dataName}
* @Inject() * @Inject()
* @var {daoName} * @var {daoName}
*/ */
private ${daoName}; private ${varDaoName};
} }
\ No newline at end of file
...@@ -85,6 +85,7 @@ class GenerateCommand ...@@ -85,6 +85,7 @@ class GenerateCommand
$content = file_get_contents($templatePath); $content = file_get_contents($templatePath);
$content = str_replace('{dataName}', $dataName, $content); $content = str_replace('{dataName}', $dataName, $content);
$content = str_replace("{daoName}", $daoName, $content); $content = str_replace("{daoName}", $daoName, $content);
$content = str_replace("{varDaoName}", lcfirst($daoName), $content);
file_put_contents($dataPath, $content); file_put_contents($dataPath, $content);
...@@ -111,6 +112,7 @@ class GenerateCommand ...@@ -111,6 +112,7 @@ class GenerateCommand
$content = str_replace("{className}", $daoName,$content); $content = str_replace("{className}", $daoName,$content);
$content = str_replace("{entityName}", $entityName, $content); $content = str_replace("{entityName}", $entityName, $content);
$content = str_replace("{varEntityName}", lcfirst($entityName), $content);
file_put_contents($daoPath,$content); file_put_contents($daoPath,$content);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment