diff --git a/src/test/resources/codetpls/controller.java.btl b/src/test/resources/codetpls/controller.java.btl index f8ecd22..bb50005 100644 --- a/src/test/resources/codetpls/controller.java.btl +++ b/src/test/resources/codetpls/controller.java.btl @@ -51,6 +51,9 @@ public class ${table.controllerName} { <% if(isNotEmpty(controllerMethods.list)){ %> @GetMapping(value = "/list") + <% if(!restControllerStyle){ %> + @ResponseBody + <% } %> public CommonResult.Pagination<${table.entityName}> list(Page<${table.entityName}> page) { CommonResult.Pagination<${table.entityName}> pagination = CommonResult.Pagination.init(); page.transferOrderField(${table.entityName}.class); @@ -61,6 +64,9 @@ public class ${table.controllerName} { <% if(isNotEmpty(controllerMethods.getById)){ %> @GetMapping(value = "/{id}") + <% if(!restControllerStyle){ %> + @ResponseBody + <% } %> public CommonResult.Single<${table.entityName}> getById(@PathVariable("id") Serializable id) { CommonResult.Single<${table.entityName}> single = CommonResult.Single.init(); return single.data(${serviceInstanceName}.getById(id)).message("查询成功"); @@ -68,6 +74,9 @@ public class ${table.controllerName} { <% } %> <% if(isNotEmpty(controllerMethods.create)){ %> + <% if(!restControllerStyle){ %> + @ResponseBody + <% } %> @PostMapping(value = "/insert") public CommonResult.Single<${table.entityName}> insert(${table.entityName} ${entityInstanceName}) { CommonResult.Single<${table.entityName}> single = CommonResult.Single.init(); @@ -78,6 +87,9 @@ public class ${table.controllerName} { <% if(isNotEmpty(controllerMethods.delete)){ %> @GetMapping(value = "/delete/{id}") + <% if(!restControllerStyle){ %> + @ResponseBody + <% } %> public CommonResult.Single delete(@PathVariable("id") Serializable id) { CommonResult.Single single = CommonResult.Single.init(); ${serviceInstanceName}.removeById(id); @@ -87,6 +99,9 @@ public class ${table.controllerName} { <% if(isNotEmpty(controllerMethods.update)){ %> @PostMapping(value = "/update") + <% if(!restControllerStyle){ %> + @ResponseBody + <% } %> public CommonResult.Single<${table.entityName}> update(${table.entityName} ${entityInstanceName}) { CommonResult.Single<${table.entityName}> single = CommonResult.Single.init(); ${serviceInstanceName}.updateById(${entityInstanceName});