代码生成配合swagger生成
This commit is contained in:
@ -19,6 +19,8 @@ import com.ruoyi.common.enums.BusinessType;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
#elseif($table.tree)
|
||||
@ -31,15 +33,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = {"${functionName}"})
|
||||
@RequestMapping("/${moduleName}/${businessName}")
|
||||
public class ${ClassName}Controller extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private I${ClassName}Service ${className}Service;
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*/
|
||||
@ApiOperation(value = "查询${functionName}列表")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
@ -57,9 +58,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* 导出${functionName}列表
|
||||
*/
|
||||
@ApiOperation(value = "导出${functionName}列表")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ -70,9 +69,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
util.exportExcel(response, list, "${functionName}数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取${functionName}详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取${functionName}详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||
@ -80,9 +77,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
return AjaxResult.success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*/
|
||||
@ApiOperation(value = "新增${functionName}")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ -91,9 +86,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
return toAjax(${className}Service.insert${ClassName}(${className}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*/
|
||||
@ApiOperation(value = "修改${functionName}")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ -102,9 +95,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
return toAjax(${className}Service.update${ClassName}(${className}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*/
|
||||
@ApiOperation(value = "删除${functionName}")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
|
@ -6,6 +6,8 @@ import ${import};
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
#elseif($table.tree)
|
||||
@ -23,6 +25,7 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
||||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
@ApiModel("${functionName}")
|
||||
public class ${ClassName} extends ${Entity}
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -46,6 +49,7 @@ public class ${ClassName} extends ${Entity}
|
||||
@Excel(name = "${comment}")
|
||||
#end
|
||||
#end
|
||||
@ApiModelProperty(value = "${column.columnComment}")
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
|
Reference in New Issue
Block a user