Commit a21bd914b736ea364de203c5da14b81cee19abec
1 parent
c336e694
Exists in
master
update version
Showing
5 changed files
with
14 additions
and
64 deletions
Show diff stats
build.gradle
src/main/resources/template/bazhuayun/ManageControllerTemplate.ftl
| ... | ... | @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping; |
| 12 | 12 | import org.springframework.web.bind.annotation.PutMapping; |
| 13 | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 15 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 15 | 16 | |
| 16 | 17 | import ${basePackage}.bean.entity.${entityClassSimpleName}; |
| 17 | 18 | import ${basePackage}.constants.GlobalConstants; |
| ... | ... | @@ -80,7 +81,7 @@ public class ${controllerClassName} { |
| 80 | 81 | * @apiUse ResultInfo |
| 81 | 82 | */ |
| 82 | 83 | @GetMapping("/{ssid}") |
| 83 | - public ResultInfo get(String ssid){ | |
| 84 | + public ResultInfo get(@PathVariable String ssid){ | |
| 84 | 85 | return this.${serviceClassFieldName}.getOneManage(ssid); |
| 85 | 86 | } |
| 86 | 87 | |
| ... | ... | @@ -112,7 +113,7 @@ public class ${controllerClassName} { |
| 112 | 113 | * @apiUse ResultInfo |
| 113 | 114 | */ |
| 114 | 115 | @DeleteMapping("/{ssid}") |
| 115 | - public ResultInfo delete(String ssid){ | |
| 116 | + public ResultInfo delete(@PathVariable String ssid){ | |
| 116 | 117 | return this.${serviceClassFieldName}.deleteManage(ssid); |
| 117 | 118 | } |
| 118 | 119 | |
| ... | ... | @@ -128,7 +129,7 @@ public class ${controllerClassName} { |
| 128 | 129 | * @apiUse ResultInfo |
| 129 | 130 | */ |
| 130 | 131 | @PutMapping("/{ssid}") |
| 131 | - public ResultInfo put(String ssid, HttpServletRequest request){ | |
| 132 | + public ResultInfo put(@PathVariable String ssid, HttpServletRequest request){ | |
| 132 | 133 | return this.${serviceClassFieldName}.putManage(ssid, UtilHttpRequestMap.getUpdateListByRequestMap(request.getParameterMap(), ${entityClassSimpleName}.class, null)); |
| 133 | 134 | } |
| 134 | 135 | ... | ... |
src/main/resources/template/bazhuayun/ServiceImplTemplate.ftl
| ... | ... | @@ -40,38 +40,6 @@ public class ${serviceImplClassSimpleName} implements ${serviceClassSimpleName} |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | @Override |
| 43 | - public ResultInfo putV1(String ssid, List<Object[]> updateList) { | |
| 44 | - try{ | |
| 45 | - this.${repositoryClassFieldName}.updateEntityBySsid(ssid, updateList); | |
| 46 | - }catch(Exception e){ | |
| 47 | - UtilLog.errorForException(e, this.getClass()); | |
| 48 | - return UtilResultInfo.getFailure(e.getMessage()); | |
| 49 | - } | |
| 50 | - return UtilResultInfo.getSuccess("更新成功"); | |
| 51 | - } | |
| 52 | - | |
| 53 | - @Override | |
| 54 | - public ResultInfo deleteV1(String ssid) { | |
| 55 | - try{ | |
| 56 | - this.${repositoryClassFieldName}.deleteEntityBySsid(ssid); | |
| 57 | - }catch(Exception e){ | |
| 58 | - UtilLog.errorForException(e, this.getClass()); | |
| 59 | - return UtilResultInfo.getFailure(e.getMessage()); | |
| 60 | - } | |
| 61 | - return UtilResultInfo.getSuccess("删除成功"); | |
| 62 | - } | |
| 63 | - | |
| 64 | - @Override | |
| 65 | - public ResultInfo postV1(Map<String, Object> data) { | |
| 66 | - try { | |
| 67 | - return UtilResultInfo.getSuccess("创建成功", this.${repositoryClassFieldName}.addEntityByMap(data)); | |
| 68 | - } catch (Exception e) { | |
| 69 | - UtilLog.errorForException(e, this.getClass()); | |
| 70 | - return UtilResultInfo.getFailure(e.getMessage()); | |
| 71 | - } | |
| 72 | - } | |
| 73 | - | |
| 74 | - @Override | |
| 75 | 43 | public ResultInfo getListManage(List<Object[]> condition, Integer page, Integer size) { |
| 76 | 44 | try { |
| 77 | 45 | return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoPage(condition, page, size)); | ... | ... |
src/main/resources/template/bazhuayun/ServiceTemplate.ftl
| ... | ... | @@ -21,28 +21,7 @@ public interface ${serviceClassSimpleName} { |
| 21 | 21 | * @return |
| 22 | 22 | */ |
| 23 | 23 | public ResultInfo getOneV1(String ssid); |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 修改ssid对应的数据 | |
| 27 | - * @param ssid | |
| 28 | - * @return | |
| 29 | - */ | |
| 30 | - public ResultInfo putV1(String ssid, List<Object[]> updateList); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 删除ssid对应的数据 | |
| 34 | - * @param ssid | |
| 35 | - * @return | |
| 36 | - */ | |
| 37 | - public ResultInfo deleteV1(String ssid); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 创建数据 | |
| 41 | - * @param ssid | |
| 42 | - * @return | |
| 43 | - */ | |
| 44 | - public ResultInfo postV1(Map<String, Object> data); | |
| 45 | - | |
| 24 | + | |
| 46 | 25 | /** |
| 47 | 26 | * 获取列表 |
| 48 | 27 | * @param condition | ... | ... |
src/main/resources/template/bazhuayun/V1ControllerTemplate.ftl
| ... | ... | @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping; |
| 12 | 12 | import org.springframework.web.bind.annotation.PutMapping; |
| 13 | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 15 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 15 | 16 | |
| 16 | 17 | import ${basePackage}.bean.entity.${entityClassSimpleName}; |
| 17 | 18 | import ${basePackage}.constants.GlobalConstants; |
| ... | ... | @@ -19,6 +20,7 @@ import ${basePackage}.service.${serviceClassSimpleName}; |
| 19 | 20 | |
| 20 | 21 | import com.taover.util.UtilHttpRequestMap; |
| 21 | 22 | import com.taover.util.bean.ResultInfo; |
| 23 | +import com.taover.util.bean.UtilResultInfo; | |
| 22 | 24 | |
| 23 | 25 | @RestController("v1.${controllerMap}") |
| 24 | 26 | @RequestMapping("/v1/${controllerMap}") |
| ... | ... | @@ -80,7 +82,7 @@ public class ${controllerClassName} { |
| 80 | 82 | * @apiUse ResultInfo |
| 81 | 83 | */ |
| 82 | 84 | @GetMapping("/{ssid}") |
| 83 | - public ResultInfo get(String ssid){ | |
| 85 | + public ResultInfo get(@PathVariable String ssid){ | |
| 84 | 86 | return this.${serviceClassFieldName}.getOneV1(ssid); |
| 85 | 87 | } |
| 86 | 88 | |
| ... | ... | @@ -97,7 +99,7 @@ public class ${controllerClassName} { |
| 97 | 99 | */ |
| 98 | 100 | @PostMapping |
| 99 | 101 | public ResultInfo post(HttpServletRequest request){ |
| 100 | - return this.${serviceClassFieldName}.postV1(UtilHttpRequestMap.getMapValueStringByRequestMap(request.getParameterMap())); | |
| 102 | + return UtilResultInfo.getFailure("没有找到对应处理逻辑"); | |
| 101 | 103 | } |
| 102 | 104 | |
| 103 | 105 | /** |
| ... | ... | @@ -112,8 +114,8 @@ public class ${controllerClassName} { |
| 112 | 114 | * @apiUse ResultInfo |
| 113 | 115 | */ |
| 114 | 116 | @DeleteMapping("/{ssid}") |
| 115 | - public ResultInfo delete(String ssid){ | |
| 116 | - return this.${serviceClassFieldName}.deleteV1(ssid); | |
| 117 | + public ResultInfo delete(@PathVariable String ssid){ | |
| 118 | + return UtilResultInfo.getFailure("没有找到对应处理逻辑"); | |
| 117 | 119 | } |
| 118 | 120 | |
| 119 | 121 | /** |
| ... | ... | @@ -128,8 +130,8 @@ public class ${controllerClassName} { |
| 128 | 130 | * @apiUse ResultInfo |
| 129 | 131 | */ |
| 130 | 132 | @PutMapping("/{ssid}") |
| 131 | - public ResultInfo put(String ssid, HttpServletRequest request){ | |
| 132 | - return this.${serviceClassFieldName}.putV1(ssid, UtilHttpRequestMap.getUpdateListByRequestMap(request.getParameterMap(), ${entityClassSimpleName}.class, null)); | |
| 133 | + public ResultInfo put(@PathVariable String ssid, HttpServletRequest request){ | |
| 134 | + return UtilResultInfo.getFailure("没有找到对应处理逻辑"); | |
| 133 | 135 | } |
| 134 | 136 | |
| 135 | 137 | } | ... | ... |