Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
services
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tencent
services
Commits
b140b9a7
Commit
b140b9a7
authored
Oct 08, 2018
by
feixiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成dao,data,变量名修改
parent
8c522818
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
src/Commands/ClassTemplate/Dao/ClassTemplate
+3
-3
src/Commands/ClassTemplate/Data/ClassTemplate
+2
-1
src/Commands/GenerateCommand
+2
-0
No files found.
src/Commands/ClassTemplate/Dao/ClassTemplate
View file @
b140b9a7
...
@@ -20,13 +20,13 @@ class {className}
...
@@ -20,13 +20,13 @@ class {className}
public function create(array $info) : {entityName}
public function create(array $info) : {entityName}
{
{
${
e
ntityName} = new {entityName}($info);
${
varE
ntityName} = new {entityName}($info);
$res = ${
e
ntityName}->save()->getResult();
$res = ${
varE
ntityName}->save()->getResult();
if ( $res === false ) {
if ( $res === false ) {
throw new CommonException(["msg" => "数据库操作错误", "code" => 500]);
throw new CommonException(["msg" => "数据库操作错误", "code" => 500]);
}
}
return ${
e
ntityName};
return ${
varE
ntityName};
}
}
public function selectInfoByCondition($condition, $field)
public function selectInfoByCondition($condition, $field)
...
...
src/Commands/ClassTemplate/Data/ClassTemplate
View file @
b140b9a7
...
@@ -23,6 +23,6 @@ class {dataName}
...
@@ -23,6 +23,6 @@ class {dataName}
* @Inject()
* @Inject()
* @var {daoName}
* @var {daoName}
*/
*/
private ${
d
aoName};
private ${
varD
aoName};
}
}
\ No newline at end of file
src/Commands/GenerateCommand
View file @
b140b9a7
...
@@ -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);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment