Commit 5d3d1c013b35648b3471f6c5294ec797625a87a5
1 parent
7f49be57
Exists in
master
update id deal
Showing
7 changed files
with
51 additions
and
66 deletions
Show diff stats
build.gradle
src/main/resources/template/bazhuayun/ManageControllerTemplate.ftl
... | ... | @@ -70,7 +70,7 @@ public class ${controllerClassName} { |
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | - * @api {GET} /manage/${controllerMap}/{ssid} 查询ssid对应的${controllerMap} | |
73 | + * @api {GET} /manage/${controllerMap}/{id} 查询id对应的${controllerMap} | |
74 | 74 | * @apiDescription 查询ssid对应${controllerMap}数据 |
75 | 75 | * |
76 | 76 | * @apiGroup ${controllerMap} |
... | ... | @@ -80,9 +80,9 @@ public class ${controllerClassName} { |
80 | 80 | * |
81 | 81 | * @apiUse ResultInfo |
82 | 82 | */ |
83 | - @GetMapping("/{ssid}") | |
84 | - public ResultInfo get(@PathVariable String ssid){ | |
85 | - return this.${serviceClassFieldName}.getOneManage(ssid); | |
83 | + @GetMapping("/{id}") | |
84 | + public ResultInfo get(@PathVariable Integer id){ | |
85 | + return this.${serviceClassFieldName}.getOneManage(id); | |
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
... | ... | @@ -102,8 +102,8 @@ public class ${controllerClassName} { |
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | - * @api {DELETE} /manage/${controllerMap}/{ssid} 删除ssid对应的${controllerMap} | |
106 | - * @apiDescription 删除ssid对应的${controllerMap}数据 | |
105 | + * @api {DELETE} /manage/${controllerMap}/{id} 删除id对应的${controllerMap} | |
106 | + * @apiDescription 删除id对应的${controllerMap}数据 | |
107 | 107 | * |
108 | 108 | * @apiGroup ${controllerMap} |
109 | 109 | * @apiName 删除实体数据 |
... | ... | @@ -112,13 +112,13 @@ public class ${controllerClassName} { |
112 | 112 | * |
113 | 113 | * @apiUse ResultInfo |
114 | 114 | */ |
115 | - @DeleteMapping("/{ssid}") | |
116 | - public ResultInfo delete(@PathVariable String ssid){ | |
117 | - return this.${serviceClassFieldName}.deleteManage(ssid); | |
115 | + @DeleteMapping("/{id}") | |
116 | + public ResultInfo delete(@PathVariable Integer id){ | |
117 | + return this.${serviceClassFieldName}.deleteManage(id); | |
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | - * @api {PUT} /manage/${controllerMap}/{ssid} 修改${controllerMap}数据 | |
121 | + * @api {PUT} /manage/${controllerMap}/{id} 修改${controllerMap}数据 | |
122 | 122 | * @apiDescription 修改${controllerMap}数据 |
123 | 123 | * |
124 | 124 | * @apiGroup ${controllerMap} |
... | ... | @@ -128,9 +128,9 @@ public class ${controllerClassName} { |
128 | 128 | * |
129 | 129 | * @apiUse ResultInfo |
130 | 130 | */ |
131 | - @PutMapping("/{ssid}") | |
132 | - public ResultInfo put(@PathVariable String ssid, HttpServletRequest request){ | |
133 | - return this.${serviceClassFieldName}.putManage(ssid, UtilHttpRequestMap.getUpdateListByRequestMap(request.getParameterMap(), ${entityClassSimpleName}.class, null)); | |
131 | + @PutMapping("/{id}") | |
132 | + public ResultInfo put(@PathVariable Integer id, HttpServletRequest request){ | |
133 | + return this.${serviceClassFieldName}.putManage(id, UtilHttpRequestMap.getUpdateListByRequestMap(request.getParameterMap(), ${entityClassSimpleName}.class, null)); | |
134 | 134 | } |
135 | 135 | |
136 | 136 | } | ... | ... |
src/main/resources/template/bazhuayun/RepositoryTemplate.ftl
... | ... | @@ -42,28 +42,23 @@ public class ${repositoryClassSimpleName} extends CustomJdbcTemplate<${entityCla |
42 | 42 | entityData.put("rows", voList); |
43 | 43 | return entityData; |
44 | 44 | } |
45 | - | |
46 | - public ${voClassSimpleName} getVoBySsid(String ssid) throws Exception{ | |
47 | - return this.getVoByEntity(this.findEntityByID(this.getIdBySsid(ssid))); | |
48 | - } | |
49 | - | |
45 | + | |
50 | 46 | public ${voClassSimpleName} getVoByEntity(${entityClassSimpleName} entity) throws Exception{ |
51 | 47 | ${voClassSimpleName} voObj = null; |
52 | 48 | try { |
53 | - voObj = UtilObject.fieldCopy(entity, ${voClassSimpleName}.class, true, new String[]{"id"}); | |
49 | + voObj = UtilObject.fieldCopy(entity, ${voClassSimpleName}.class, true, null); | |
54 | 50 | } catch (Exception e) { |
55 | 51 | throw new Exception("对象转换失败"); |
56 | 52 | } |
57 | - voObj.setSsid(this.getSsidById(entity.getId())); | |
58 | 53 | return voObj; |
59 | 54 | } |
60 | 55 | |
61 | - public void updateEntityBySsid(String ssid, List<Object[]> updateList) throws Exception{ | |
62 | - this.updateEntityById(updateList, this.getIdBySsid(ssid)); | |
56 | + public void updateEntityById(Integer id, List<Object[]> updateList) throws Exception{ | |
57 | + this.updateEntityById(updateList, id); | |
63 | 58 | } |
64 | 59 | |
65 | - public void deleteEntityBySsid(String ssid) throws Exception{ | |
66 | - this.deleteEntityByID(this.getIdBySsid(ssid)); | |
60 | + public void deleteEntityById(Integer id) throws Exception{ | |
61 | + this.deleteEntityByID(id); | |
67 | 62 | } |
68 | 63 | |
69 | 64 | public ${voClassSimpleName} addEntityByMap(Map<String, Object> data) throws Exception{ | ... | ... |
src/main/resources/template/bazhuayun/ServiceImplTemplate.ftl
... | ... | @@ -30,9 +30,9 @@ public class ${serviceImplClassSimpleName} implements ${serviceClassSimpleName} |
30 | 30 | } |
31 | 31 | |
32 | 32 | @Override |
33 | - public ResultInfo getOneV1(String ssid) { | |
33 | + public ResultInfo getOneV1(Integer id) { | |
34 | 34 | try { |
35 | - return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoBySsid(ssid)); | |
35 | + return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.findEntityById(id)); | |
36 | 36 | } catch (Exception e) { |
37 | 37 | UtilLog.errorForException(e, this.getClass()); |
38 | 38 | return UtilResultInfo.getFailure(e.getMessage()); |
... | ... | @@ -50,18 +50,18 @@ public class ${serviceImplClassSimpleName} implements ${serviceClassSimpleName} |
50 | 50 | } |
51 | 51 | |
52 | 52 | @Override |
53 | - public ResultInfo getOneManage(String ssid) { | |
53 | + public ResultInfo getOneManage(Integer id) { | |
54 | 54 | try { |
55 | - return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoBySsid(ssid)); | |
55 | + return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.findEntityById(id)); | |
56 | 56 | } catch (Exception e) { |
57 | 57 | return UtilResultInfo.getFailure(e.getMessage()); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | @Override |
62 | - public ResultInfo putManage(String ssid, List<Object[]> updateList) { | |
62 | + public ResultInfo putManage(Integer id, List<Object[]> updateList) { | |
63 | 63 | try{ |
64 | - this.${repositoryClassFieldName}.updateEntityBySsid(ssid, updateList); | |
64 | + this.${repositoryClassFieldName}.updateEntityById(id, updateList); | |
65 | 65 | }catch(Exception e){ |
66 | 66 | UtilLog.errorForException(e, this.getClass()); |
67 | 67 | return UtilResultInfo.getFailure(e.getMessage()); |
... | ... | @@ -70,9 +70,9 @@ public class ${serviceImplClassSimpleName} implements ${serviceClassSimpleName} |
70 | 70 | } |
71 | 71 | |
72 | 72 | @Override |
73 | - public ResultInfo deleteManage(String ssid) { | |
73 | + public ResultInfo deleteManage(Integer id) { | |
74 | 74 | try{ |
75 | - this.${repositoryClassFieldName}.deleteEntityBySsid(ssid); | |
75 | + this.${repositoryClassFieldName}.deleteEntityById(id); | |
76 | 76 | }catch(Exception e){ |
77 | 77 | UtilLog.errorForException(e, this.getClass()); |
78 | 78 | return UtilResultInfo.getFailure(e.getMessage()); | ... | ... |
src/main/resources/template/bazhuayun/ServiceTemplate.ftl
... | ... | @@ -16,11 +16,11 @@ public interface ${serviceClassSimpleName} { |
16 | 16 | public ResultInfo getListV1(List<Object[]> condition, Integer page, Integer size); |
17 | 17 | |
18 | 18 | /** |
19 | - * 获取ssid对应的数据 | |
20 | - * @param ssid | |
19 | + * 获取id对应的数据 | |
20 | + * @param id | |
21 | 21 | * @return |
22 | 22 | */ |
23 | - public ResultInfo getOneV1(String ssid); | |
23 | + public ResultInfo getOneV1(Integer id); | |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * 获取列表 |
... | ... | @@ -32,29 +32,30 @@ public interface ${serviceClassSimpleName} { |
32 | 32 | public ResultInfo getListManage(List<Object[]> condition, Integer page, Integer size); |
33 | 33 | |
34 | 34 | /** |
35 | - * 获取ssid对应的数据 | |
36 | - * @param ssid | |
35 | + * 获取id对应的数据 | |
36 | + * @param id | |
37 | 37 | * @return |
38 | 38 | */ |
39 | - public ResultInfo getOneManage(String ssid); | |
39 | + public ResultInfo getOneManage(Integer id); | |
40 | 40 | |
41 | 41 | /** |
42 | - * 修改ssid对应的数据 | |
43 | - * @param ssid | |
42 | + * 修改id对应的数据 | |
43 | + * @param id | |
44 | + * @param updateList | |
44 | 45 | * @return |
45 | 46 | */ |
46 | - public ResultInfo putManage(String ssid, List<Object[]> updateList); | |
47 | + public ResultInfo putManage(Integer id, List<Object[]> updateList); | |
47 | 48 | |
48 | 49 | /** |
49 | 50 | * 删除ssid对应的数据 |
50 | - * @param ssid | |
51 | + * @param id | |
51 | 52 | * @return |
52 | 53 | */ |
53 | - public ResultInfo deleteManage(String ssid); | |
54 | + public ResultInfo deleteManage(Integer id); | |
54 | 55 | |
55 | 56 | /** |
56 | 57 | * 创建数据 |
57 | - * @param ssid | |
58 | + * @param data | |
58 | 59 | * @return |
59 | 60 | */ |
60 | 61 | public ResultInfo postManage(Map<String, Object> data); | ... | ... |
src/main/resources/template/bazhuayun/V1ControllerTemplate.ftl
... | ... | @@ -71,7 +71,7 @@ public class ${controllerClassName} { |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | - * @api {GET} /v1/${controllerMap}/{ssid} 查询ssid对应的${controllerMap} | |
74 | + * @api {GET} /v1/${controllerMap}/{id} 查询ssid对应的${controllerMap} | |
75 | 75 | * @apiDescription 查询ssid对应${controllerMap}数据 |
76 | 76 | * |
77 | 77 | * @apiGroup ${controllerMap} |
... | ... | @@ -81,9 +81,9 @@ public class ${controllerClassName} { |
81 | 81 | * |
82 | 82 | * @apiUse ResultInfo |
83 | 83 | */ |
84 | - @GetMapping("/{ssid}") | |
85 | - public ResultInfo get(@PathVariable String ssid){ | |
86 | - return this.${serviceClassFieldName}.getOneV1(ssid); | |
84 | + @GetMapping("/{id}") | |
85 | + public ResultInfo get(@PathVariable Integer id){ | |
86 | + return this.${serviceClassFieldName}.getOneV1(id); | |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
... | ... | @@ -103,7 +103,7 @@ public class ${controllerClassName} { |
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | - * @api {DELETE} /v1/${controllerMap}/{ssid} 删除ssid对应的${controllerMap} | |
106 | + * @api {DELETE} /v1/${controllerMap}/{id} 删除id对应的${controllerMap} | |
107 | 107 | * @apiDescription 删除ssid对应的${controllerMap}数据 |
108 | 108 | * |
109 | 109 | * @apiGroup ${controllerMap} |
... | ... | @@ -113,13 +113,13 @@ public class ${controllerClassName} { |
113 | 113 | * |
114 | 114 | * @apiUse ResultInfo |
115 | 115 | */ |
116 | - @DeleteMapping("/{ssid}") | |
117 | - public ResultInfo delete(@PathVariable String ssid){ | |
116 | + @DeleteMapping("/{id}") | |
117 | + public ResultInfo delete(@PathVariable Integer id){ | |
118 | 118 | return UtilResultInfo.getFailure("没有找到对应处理逻辑"); |
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * @api {PUT} /v1/${controllerMap}/{ssid} 修改${controllerMap}数据 | |
122 | + * @api {PUT} /v1/${controllerMap}/{id} 修改${controllerMap}数据 | |
123 | 123 | * @apiDescription 修改${controllerMap}数据 |
124 | 124 | * |
125 | 125 | * @apiGroup ${controllerMap} |
... | ... | @@ -129,8 +129,8 @@ public class ${controllerClassName} { |
129 | 129 | * |
130 | 130 | * @apiUse ResultInfo |
131 | 131 | */ |
132 | - @PutMapping("/{ssid}") | |
133 | - public ResultInfo put(@PathVariable String ssid, HttpServletRequest request){ | |
132 | + @PutMapping("/{id}") | |
133 | + public ResultInfo put(@PathVariable Integer id, HttpServletRequest request){ | |
134 | 134 | return UtilResultInfo.getFailure("没有找到对应处理逻辑"); |
135 | 135 | } |
136 | 136 | ... | ... |
src/main/resources/template/bazhuayun/VoTemplate.ftl
... | ... | @@ -16,22 +16,12 @@ public class ${voClassSimpleName} implements Serializable { |
16 | 16 | |
17 | 17 | <#--变量 ,get,set方法--> |
18 | 18 | <#if tablemodel.columnlist?exists> |
19 | - private String ssid; | |
20 | - | |
21 | - public String getSsid(){ | |
22 | - return ssid; | |
23 | - } | |
24 | - public void setSsid(String ssid){ | |
25 | - this.ssid = ssid; | |
26 | - } | |
27 | - | |
28 | 19 | <#list tablemodel.columnlist as clist> |
29 | 20 | <#if clist.columnRemarks?exists> |
30 | 21 | /** |
31 | 22 | * ${clist.columnRemarks} |
32 | 23 | */ |
33 | 24 | </#if> |
34 | - <#if clist.columnName != "id" && clist.columnName != "ssid" > | |
35 | 25 | private ${clist.columnJAVAType} ${clist.columnName}; |
36 | 26 | |
37 | 27 | public ${clist.columnJAVAType} get${clist.columnMethodName}(){ |
... | ... | @@ -40,7 +30,6 @@ public class ${voClassSimpleName} implements Serializable { |
40 | 30 | public void set${clist.columnMethodName}(${clist.columnJAVAType} ${clist.columnName}){ |
41 | 31 | this.${clist.columnName} = ${clist.columnName}; |
42 | 32 | } |
43 | - </#if> | |
44 | 33 | </#list> |
45 | 34 | </#if> |
46 | 35 | ... | ... |