接口文档注解
parent
f76c53aac2
commit
25c38ebeef
|
@ -2,6 +2,8 @@ package ${packageName}.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -30,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
|
@Api("${functionName}")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/${moduleName}/${businessName}")
|
@RequestMapping("/${moduleName}/${businessName}")
|
||||||
public class ${ClassName}Controller extends BaseController {
|
public class ${ClassName}Controller extends BaseController {
|
||||||
|
@ -39,6 +42,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取${functionName}列表")
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
|
@ -57,11 +61,12 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 导出${functionName}列表
|
* 导出${functionName}列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("导出${functionName}列表")
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, ${ClassName} ${className}) {
|
public void export(HttpServletResponse response, ${ClassName} ${className}) {
|
||||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
List<${ClassName}> list = ${className}Service.list(${className});
|
||||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
||||||
util.exportExcel(response, list, "${functionName}数据");
|
util.exportExcel(response, list, "${functionName}数据");
|
||||||
}
|
}
|
||||||
|
@ -69,8 +74,10 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取${functionName}详细信息
|
* 获取${functionName}详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取${functionName}详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
|
||||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||||
|
@ApiImplicitParam(name = "${pkColumn.javaField}", value = "${pkColumn.javaField}", required = true, dataType = "${pkColumn.javaType}", paramType = "path", dataTypeClass = ${pkColumn.javaType}.class)
|
||||||
public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||||
return success(${className}Service.getById(${pkColumn.javaField}));
|
return success(${className}Service.getById(${pkColumn.javaField}));
|
||||||
}
|
}
|
||||||
|
@ -81,6 +88,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@ApiOperation("新增${functionName}")
|
||||||
public Result add(@RequestBody ${ClassName} ${className}) {
|
public Result add(@RequestBody ${ClassName} ${className}) {
|
||||||
return toAjax(${className}Service.save(${className}));
|
return toAjax(${className}Service.save(${className}));
|
||||||
}
|
}
|
||||||
|
@ -91,6 +99,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@ApiOperation("修改${functionName}")
|
||||||
public Result edit(@RequestBody ${ClassName} ${className}) {
|
public Result edit(@RequestBody ${ClassName} ${className}) {
|
||||||
return toAjax(${className}Service.updateById(${className}));
|
return toAjax(${className}Service.updateById(${className}));
|
||||||
}
|
}
|
||||||
|
@ -101,6 +110,8 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
|
||||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||||
|
@ApiOperation("删除${functionName}")
|
||||||
|
@ApiImplicitParam(name = "${pkColumn.javaField}", value = "${pkColumn.javaField}", required = true, dataType = "${pkColumn.javaType}", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
public Result remove(@PathVariable List<${pkColumn.javaType}> ${pkColumn.javaField}s) {
|
public Result remove(@PathVariable List<${pkColumn.javaType}> ${pkColumn.javaField}s) {
|
||||||
return toAjax(${className}Service.removeBatchByIds(${pkColumn.javaField}s));
|
return toAjax(${className}Service.removeBatchByIds(${pkColumn.javaField}s));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import io.swagger.annotations.*;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
@ -34,9 +33,11 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("${tableName}")
|
@TableName("${tableName}")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "${ClassName}", description = "${functionName}")
|
||||||
public class ${ClassName} extends ${Entity} {
|
public class ${ClassName} extends ${Entity} {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
@ -61,6 +62,7 @@ public class ${ClassName} extends ${Entity} {
|
||||||
#if($column.javaField == $pkColumn.javaField)
|
#if($column.javaField == $pkColumn.javaField)
|
||||||
@TableId(value = "${pkColumn.javaField}",type = IdType.AUTO)
|
@TableId(value = "${pkColumn.javaField}",type = IdType.AUTO)
|
||||||
#end
|
#end
|
||||||
|
@ApiModelProperty(name = "${comment}")
|
||||||
private $column.javaType $column.javaField;
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.ruoyi.book.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -25,8 +27,9 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
* 书籍信息Controller
|
* 书籍信息Controller
|
||||||
*
|
*
|
||||||
* @author DongZeLiang
|
* @author DongZeLiang
|
||||||
* @date 2023-10-09
|
* @date 2023-10-10
|
||||||
*/
|
*/
|
||||||
|
@Api("书籍信息")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/book/info")
|
@RequestMapping("/book/info")
|
||||||
public class BookInfoController extends BaseController {
|
public class BookInfoController extends BaseController {
|
||||||
|
@ -36,6 +39,7 @@ public class BookInfoController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询书籍信息列表
|
* 查询书籍信息列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取书籍信息列表")
|
||||||
@PreAuthorize("@ss.hasPermi('book:info:list')")
|
@PreAuthorize("@ss.hasPermi('book:info:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo> list(BookInfo bookInfo) {
|
public Result<TableDataInfo> list(BookInfo bookInfo) {
|
||||||
|
@ -47,6 +51,7 @@ public class BookInfoController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 导出书籍信息列表
|
* 导出书籍信息列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("导出书籍信息列表")
|
||||||
@PreAuthorize("@ss.hasPermi('book:info:export')")
|
@PreAuthorize("@ss.hasPermi('book:info:export')")
|
||||||
@Log(title = "书籍信息", businessType = BusinessType.EXPORT)
|
@Log(title = "书籍信息", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
|
@ -59,8 +64,10 @@ public class BookInfoController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取书籍信息详细信息
|
* 获取书籍信息详细信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取书籍信息详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('book:info:query')")
|
@PreAuthorize("@ss.hasPermi('book:info:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
public Result getInfo(@PathVariable("id") Long id) {
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
return success(bookInfoService.getById(id));
|
return success(bookInfoService.getById(id));
|
||||||
}
|
}
|
||||||
|
@ -71,6 +78,7 @@ public class BookInfoController extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('book:info:add')")
|
@PreAuthorize("@ss.hasPermi('book:info:add')")
|
||||||
@Log(title = "书籍信息", businessType = BusinessType.INSERT)
|
@Log(title = "书籍信息", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@ApiOperation("新增书籍信息")
|
||||||
public Result add(@RequestBody BookInfo bookInfo) {
|
public Result add(@RequestBody BookInfo bookInfo) {
|
||||||
return toAjax(bookInfoService.save(bookInfo));
|
return toAjax(bookInfoService.save(bookInfo));
|
||||||
}
|
}
|
||||||
|
@ -81,6 +89,7 @@ public class BookInfoController extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('book:info:edit')")
|
@PreAuthorize("@ss.hasPermi('book:info:edit')")
|
||||||
@Log(title = "书籍信息", businessType = BusinessType.UPDATE)
|
@Log(title = "书籍信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@ApiOperation("修改书籍信息")
|
||||||
public Result edit(@RequestBody BookInfo bookInfo) {
|
public Result edit(@RequestBody BookInfo bookInfo) {
|
||||||
return toAjax(bookInfoService.updateById(bookInfo));
|
return toAjax(bookInfoService.updateById(bookInfo));
|
||||||
}
|
}
|
||||||
|
@ -91,6 +100,8 @@ public class BookInfoController extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('book:info:remove')")
|
@PreAuthorize("@ss.hasPermi('book:info:remove')")
|
||||||
@Log(title = "书籍信息", businessType = BusinessType.DELETE)
|
@Log(title = "书籍信息", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除书籍信息")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
public Result remove(@PathVariable List<Long> ids) {
|
public Result remove(@PathVariable List<Long> ids) {
|
||||||
return toAjax(bookInfoService.removeBatchByIds(ids));
|
return toAjax(bookInfoService.removeBatchByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,12 @@ import java.math.BigDecimal;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import io.swagger.annotations.*;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
@ -20,7 +18,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
* 书籍信息对象 book_info
|
* 书籍信息对象 book_info
|
||||||
*
|
*
|
||||||
* @author DongZeLiang
|
* @author DongZeLiang
|
||||||
* @date 2023-10-08
|
* @date 2023-10-10
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
|
@ -28,30 +26,24 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName("book_info")
|
@TableName("book_info")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "UserEntity", description = "用户实体")
|
@ApiModel(value = "BookInfo", description = "书籍信息")
|
||||||
public class BookInfo extends BaseEntity {
|
public class BookInfo extends BaseEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "${comment}")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 名称 */
|
/** 名称 */
|
||||||
@Excel(name = "名称")
|
@Excel(name = "名称")
|
||||||
|
@ApiModelProperty(name = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 价格 */
|
/** 价格 */
|
||||||
@Excel(name = "价格")
|
@Excel(name = "价格")
|
||||||
|
@ApiModelProperty(name = "价格")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("price", getPrice())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue