提交 | 用户 | 时间
|
1ac2bc
|
1 |
package ${controllerPackage}; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; |
|
4 |
import ${package.Entity}.${entity}; |
|
5 |
import ${package.EntitySpecParams}.${entity}Param; |
|
6 |
import ${package.Service}.${table.serviceName}; |
|
7 |
import cn.stylefeng.roses.core.base.controller.BaseController; |
|
8 |
import cn.stylefeng.roses.kernel.model.response.ResponseData; |
|
9 |
import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.stereotype.Controller; |
|
12 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
13 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
14 |
|
|
15 |
|
|
16 |
<% var lowerEntityService = lowerEntity + 'Service'; %> |
|
17 |
|
|
18 |
/** |
|
19 |
* ${tool.cleanWhite(table.comment)}控制器 |
|
20 |
* |
|
21 |
* @author ${author} |
|
22 |
* @Date ${tool.currentTime()} |
|
23 |
*/ |
|
24 |
@Controller |
|
25 |
@RequestMapping("/${lowerEntity}") |
|
26 |
public class ${entity}Controller extends BaseController { |
|
27 |
|
|
28 |
private String PREFIX = "${context.modularName}/${lowerEntity}"; |
|
29 |
|
|
30 |
@Autowired |
|
31 |
private ${entity}Service ${lowerEntityService}; |
|
32 |
|
|
33 |
/** |
|
34 |
* 跳转到主页面 |
|
35 |
* |
|
36 |
* @author ${author} |
|
37 |
* @Date ${date} |
|
38 |
*/ |
|
39 |
@RequestMapping("") |
|
40 |
public String index() { |
|
41 |
return PREFIX + "/${lowerEntity}.html"; |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* 新增页面 |
|
46 |
* |
|
47 |
* @author ${author} |
|
48 |
* @Date ${date} |
|
49 |
*/ |
|
50 |
@RequestMapping("/add") |
|
51 |
public String add() { |
|
52 |
return PREFIX + "/${lowerEntity}_add.html"; |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* 编辑页面 |
|
57 |
* |
|
58 |
* @author ${author} |
|
59 |
* @Date ${date} |
|
60 |
*/ |
|
61 |
@RequestMapping("/edit") |
|
62 |
public String edit() { |
|
63 |
return PREFIX + "/${lowerEntity}_edit.html"; |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* 新增接口 |
|
68 |
* |
|
69 |
* @author ${author} |
|
70 |
* @Date ${date} |
|
71 |
*/ |
|
72 |
@RequestMapping("/addItem") |
|
73 |
@ResponseBody |
|
74 |
@DataSource(name = "self") |
|
75 |
public ResponseData addItem(${entity}Param ${lowerEntity}Param) { |
|
76 |
this.${lowerEntity}Service.add(${lowerEntity}Param); |
|
77 |
return ResponseData.success(); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* 编辑接口 |
|
82 |
* |
|
83 |
* @author ${author} |
|
84 |
* @Date ${date} |
|
85 |
*/ |
|
86 |
@RequestMapping("/editItem") |
|
87 |
@ResponseBody |
|
88 |
@DataSource(name = "self") |
|
89 |
public ResponseData editItem(${entity}Param ${lowerEntity}Param) { |
|
90 |
this.${lowerEntity}Service.update(${lowerEntity}Param); |
|
91 |
return ResponseData.success(); |
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* 删除接口 |
|
96 |
* |
|
97 |
* @author ${author} |
|
98 |
* @Date ${date} |
|
99 |
*/ |
|
100 |
@RequestMapping("/delete") |
|
101 |
@ResponseBody |
|
102 |
@DataSource(name = "self") |
|
103 |
public ResponseData delete(${entity}Param ${lowerEntity}Param) { |
|
104 |
this.${lowerEntity}Service.delete(${lowerEntity}Param); |
|
105 |
return ResponseData.success(); |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* 查看详情接口 |
|
110 |
* |
|
111 |
* @author ${author} |
|
112 |
* @Date ${date} |
|
113 |
*/ |
|
114 |
@RequestMapping("/detail") |
|
115 |
@ResponseBody |
|
116 |
@DataSource(name = "self") |
|
117 |
public ResponseData detail(${entity}Param ${lowerEntity}Param) { |
|
118 |
${entity} detail = this.${lowerEntity}Service.getById(${lowerEntity}Param.get${bigKeyPropertyName}()); |
|
119 |
return ResponseData.success(detail); |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* 查询列表 |
|
124 |
* |
|
125 |
* @author ${author} |
|
126 |
* @Date ${date} |
|
127 |
*/ |
|
128 |
@ResponseBody |
|
129 |
@RequestMapping("/list") |
|
130 |
@DataSource(name = "self") |
|
131 |
public LayuiPageInfo list(${entity}Param ${lowerEntity}Param) { |
|
132 |
return this.${lowerEntity}Service.findPageBySpec(${lowerEntity}Param); |
|
133 |
} |
|
134 |
|
|
135 |
} |
|
136 |
|
|
137 |
|