Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
chenjunxiong
guns-vip
Commits
d3af62f9
Commit
d3af62f9
authored
Oct 27, 2017
by
stylefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升级控制器模板
parent
54f3b6c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
guns-admin/src/main/java/com/stylefeng/guns/core/template/config/ControllerConfig.java
+5
-0
guns-admin/src/main/resources/gunsTemplate/advanced/Controller.java.btl
+16
-8
No files found.
guns-admin/src/main/java/com/stylefeng/guns/core/template/config/ControllerConfig.java
View file @
d3af62f9
...
...
@@ -25,6 +25,11 @@ public class ControllerConfig {
imports
.
add
(
"org.springframework.web.bind.annotation.ResponseBody"
);
imports
.
add
(
"org.springframework.ui.Model"
);
imports
.
add
(
"org.springframework.web.bind.annotation.PathVariable"
);
imports
.
add
(
"org.springframework.beans.factory.annotation.Autowired"
);
imports
.
add
(
"com.stylefeng.guns.core.log.LogObjectHolder"
);
imports
.
add
(
"org.springframework.web.bind.annotation.RequestParam"
);
imports
.
add
(
contextConfig
.
getModelPackageName
()
+
"."
+
contextConfig
.
getEntityName
());
imports
.
add
(
"com.stylefeng.guns.modular."
+
contextConfig
.
getModuleName
()
+
".service"
+
".I"
+
contextConfig
.
getBizEnBigName
()
+
"Service"
);
this
.
imports
=
imports
;
this
.
packageName
=
"com.stylefeng.guns.modular."
+
contextConfig
.
getModuleName
()
+
".controller"
;
this
.
controllerPathTemplate
=
"\\src\\main\\java\\com\\stylefeng\\guns\\modular\\"
+
contextConfig
.
getModuleName
()
+
"\\controller\\{}Controller.java"
;
...
...
guns-admin/src/main/resources/gunsTemplate/advanced/Controller.java.btl
View file @
d3af62f9
...
...
@@ -16,6 +16,9 @@ public class ${context.bizEnBigName}Controller extends BaseController {
private
String
PREFIX
=
"/${context.moduleName}/${context.bizEnName}/"
;
@
Autowired
private
I
${
context
.
bizEnBigName
}
Service
${
context
.
bizEnName
}
Service
;
/**
*
跳转到
${
context
.
bizChName
}
首页
*/
...
...
@@ -37,6 +40,9 @@ public class ${context.bizEnBigName}Controller extends BaseController {
*/
@
RequestMapping
(
"/${context.bizEnName}_update/{${context.bizEnName}Id}"
)
public
String
${
context
.
bizEnName
}
Update
(@
PathVariable
Integer
${
context
.
bizEnName
}
Id
,
Model
model
)
{
${
context
.
entityName
}
${
context
.
bizEnName
}
=
${
context
.
bizEnName
}
Service
.
selectById
(${
context
.
bizEnName
}
Id
);
model
.
addAttribute
(
"item"
,${
context
.
bizEnName
});
LogObjectHolder
.
me
().
set
(${
context
.
bizEnName
});
return
PREFIX
+
"${context.bizEnName}_edit.html"
;
}
...
...
@@ -46,7 +52,7 @@ public class ${context.bizEnBigName}Controller extends BaseController {
@
RequestMapping
(
value
=
"/list"
)
@
ResponseBody
public
Object
list
(
String
condition
)
{
return
null
;
return
${
context
.
bizEnName
}
Service
.
selectList
(
null
)
;
}
/**
...
...
@@ -54,7 +60,8 @@ public class ${context.bizEnBigName}Controller extends BaseController {
*/
@
RequestMapping
(
value
=
"/add"
)
@
ResponseBody
public
Object
add
()
{
public
Object
add
(${
context
.
entityName
}
${
context
.
bizEnName
})
{
${
context
.
bizEnName
}
Service
.
insert
(${
context
.
bizEnName
});
return
super
.
SUCCESS_TIP
;
}
...
...
@@ -63,26 +70,27 @@ public class ${context.bizEnBigName}Controller extends BaseController {
*/
@
RequestMapping
(
value
=
"/delete"
)
@
ResponseBody
public
Object
delete
()
{
public
Object
delete
(@
RequestParam
Integer
${
context
.
bizEnName
}
Id
)
{
${
context
.
bizEnName
}
Service
.
deleteById
(${
context
.
bizEnName
}
Id
);
return
SUCCESS_TIP
;
}
/**
*
修改
${
context
.
bizChName
}
*/
@
RequestMapping
(
value
=
"/update"
)
@
ResponseBody
public
Object
update
()
{
public
Object
update
(${
context
.
entityName
}
${
context
.
bizEnName
})
{
${
context
.
bizEnName
}
Service
.
updateById
(${
context
.
bizEnName
});
return
super
.
SUCCESS_TIP
;
}
/**
*
${
context
.
bizChName
}
详情
*/
@
RequestMapping
(
value
=
"/detail"
)
@
RequestMapping
(
value
=
"/detail
/{${context.bizEnName}Id}
"
)
@
ResponseBody
public
Object
detail
()
{
return
null
;
public
Object
detail
(
@
PathVariable
(
"${context.bizEnName}Id"
)
Integer
${
context
.
bizEnName
}
Id
)
{
return
${
context
.
bizEnName
}
Service
.
selectById
(${
context
.
bizEnName
}
Id
)
;
}
}
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