1- package ${package}.${moduleName}.controller;
2-
3- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
1+ package ${package}import com.baomidou.mybatisplus.core.toolkit.Wrappers;
42import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
53import com.xkcoding.common.R;
64import com.xkcoding.scaffold.log.annotations.ApiLog;
7- import ${package}.${moduleName}.entity.${className};
8- import ${package}.${moduleName}.service.${className}Service;
5+ import io.swagger.annotations.Api;
6+ import io.swagger.annotations.ApiImplicitParam;
7+ import io.swagger.annotations.ApiImplicitParams;
8+ import io.swagger.annotations.ApiOperation;
99import lombok.AllArgsConstructor;
1010import org.springframework.web.bind.annotation.*;
1111
12+ .${moduleName}.controller;
13+ ${package}
14+ .${moduleName}.entity.${className};
15+ ${package}
16+ .${moduleName}.service.${className}Service;
17+
1218/**
1319 * <p>
1420 * ${comments}
@@ -25,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
2531@RestController
2632@AllArgsConstructor
2733@RequestMapping("/${pathName}")
34+ @Api(description = "${className}Controller", tags = {"${comments}"})
2835public class ${className}Controller {
2936
3037 private final ${className}Service ${classname}Service;
@@ -36,6 +43,8 @@ public class ${className}Controller {
3643 * @return R
3744 */
3845 @GetMapping("")
46+ @ApiOperation(value = "分页查询${comments}", notes = "分页查询${comments}")
47+ @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页参数", required = true), @ApiImplicitParam(name = "${classname}", value = "查询条件", required = true)})
3948 public R list${className}(Page page, ${className} ${classname}) {
4049 return new R<>(${classname}Service.page(page,Wrappers.query(${classname})));
4150 }
@@ -47,6 +56,8 @@ public class ${className}Controller {
4756 * @return R
4857 */
4958 @GetMapping("/{${pk.lowerAttrName}}")
59+ @ApiOperation(value = "通过id查询${comments}", notes = "通过id查询${comments}")
60+ @ApiImplicitParams({@ApiImplicitParam(name = "${pk.lowerAttrName}", value = "主键id", required = true)})
5061 public R get${className}(@PathVariable("${pk.lowerAttrName}") ${pk.attrType} ${pk.lowerAttrName}){
5162 return new R<>(${classname}Service.getById(${pk.lowerAttrName}));
5263 }
@@ -58,6 +69,7 @@ public class ${className}Controller {
5869 */
5970 @ApiLog("新增${comments}")
6071 @PostMapping
72+ @ApiOperation(value = "新增${comments}", notes = "新增${comments}")
6173 public R save${className}(@RequestBody ${className} ${classname}){
6274 return new R<>(${classname}Service.save(${classname}));
6375 }
@@ -70,6 +82,8 @@ public class ${className}Controller {
7082 */
7183 @ApiLog("修改${comments}")
7284 @PutMapping("/{${pk.lowerAttrName}}")
85+ @ApiOperation(value = "修改${comments}", notes = "修改${comments}")
86+ @ApiImplicitParams({@ApiImplicitParam(name = "${pk.lowerAttrName}", value = "主键id", required = true)})
7387 public R update${className}(@PathVariable ${pk.attrType} ${pk.lowerAttrName}, @RequestBody ${className} ${classname}){
7488 return new R<>(${classname}Service.updateById(${classname}));
7589 }
@@ -81,6 +95,8 @@ public class ${className}Controller {
8195 */
8296 @ApiLog("删除${comments}")
8397 @DeleteMapping("/{${pk.lowerAttrName}}")
98+ @ApiOperation(value = "删除${comments}", notes = "删除${comments}")
99+ @ApiImplicitParams({@ApiImplicitParam(name = "${pk.lowerAttrName}", value = "主键id", required = true)})
84100 public R delete${className}(@PathVariable ${pk.attrType} ${pk.lowerAttrName}){
85101 return new R<>(${classname}Service.removeById(${pk.lowerAttrName}));
86102 }
0 commit comments