This commit is contained in:
parent
82dbe02fee
commit
6a8ec484f2
|
|
@ -56,11 +56,11 @@ public class SwaggerConfig
|
|||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.hchyun.project.tool.swagger"))
|
||||
// 扫描所有
|
||||
.apis(RequestHandlerSelectors.any())
|
||||
//.apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ swagger:
|
|||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
pathMapping: /
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
|
|
|
|||
|
|
@ -118,6 +118,30 @@
|
|||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<!-- swagger2-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import java.util.regex.Pattern;
|
|||
import com.hchyun.common.constant.ReturnConstants;
|
||||
import com.hchyun.common.core.controller.HcyBaseController;
|
||||
import com.hchyun.common.utils.ServerResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
|
@ -37,6 +40,7 @@ import com.hchyun.common.core.page.TableDataInfo;
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@Api(value = "${functionName}管理",tags = "${functionName}管理")
|
||||
@RestController
|
||||
@RequestMapping("/${moduleName}/${businessName}")
|
||||
public class ${ClassName}Controller extends HcyBaseController {
|
||||
|
|
@ -48,6 +52,7 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
/**
|
||||
* 查询${functionName}列表
|
||||
*/
|
||||
@ApiOperation("查询${functionName}列表")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
|
|
@ -76,6 +81,7 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
/**
|
||||
* 导出${functionName}列表
|
||||
*/
|
||||
@ApiOperation("导出${functionName}列表")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
|
|
@ -97,6 +103,8 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
/**
|
||||
* 获取${functionName}详细信息
|
||||
*/
|
||||
@ApiOperation("获取${functionName}详细信息")
|
||||
@ApiImplicitParam(name = "${pkColumn.javaField}" , value = "${functionName}${pkColumn.javaField}" , required = true, dataType = "${pkColumn.javaType}" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||
|
|
@ -116,6 +124,8 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
/**
|
||||
* 新增${functionName}
|
||||
*/
|
||||
@ApiOperation("新增${functionName}")
|
||||
@ApiImplicitParam(name = "${className}" , value = "新增${functionName}信息" , dataType = "${ClassName}")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -157,6 +167,8 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
/**
|
||||
* 修改${functionName}
|
||||
*/
|
||||
@ApiOperation("修改${functionName}")
|
||||
@ApiImplicitParam(name = "${className}" , value = "修改${functionName}信息" , dataType = "${ClassName}")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -199,6 +211,8 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
/**
|
||||
* 删除${functionName}
|
||||
*/
|
||||
@ApiOperation("删除${functionName}")
|
||||
@ApiImplicitParam(name = "${pkColumn.javaField}s" , value = "${functionName}${pkColumn.javaField}s" , required = true, dataType = "${pkColumn.javaType}" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.hchyun.common.annotation.Excel;
|
|||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
import com.hchyun.common.core.entity.${Entity};
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
#if($table.crud || $table.sub)
|
||||
|
|
@ -27,6 +29,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
@ApiModel("${functionName}")
|
||||
public class ${ClassName} extends ${Entity}
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -50,12 +53,14 @@ public class ${ClassName} extends ${Entity}
|
|||
@Excel(name = "${comment}")
|
||||
#end
|
||||
#end
|
||||
@ApiModelProperty("${column.columnComment}")
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
/** $table.subTable.functionName信息 */
|
||||
@ApiModelProperty("${table.subTable.functionName}信息")
|
||||
private List<${subClassName}> ${subclassName}List;
|
||||
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import java.util.regex.Pattern;
|
|||
import com.hchyun.common.constant.ReturnConstants;
|
||||
import com.hchyun.common.core.controller.HcyBaseController;
|
||||
import com.hchyun.common.utils.ServerResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
|
@ -26,14 +29,14 @@ import com.hchyun.common.enums.BusinessType;
|
|||
import com.hchyun.test.entity.Results;
|
||||
import com.hchyun.test.service.ResultsService;
|
||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||
import com.hchyun.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 成绩Controller
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-23
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@Api(value = "成绩管理",tags = "成绩管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/results")
|
||||
public class ResultsController extends HcyBaseController {
|
||||
|
|
@ -45,6 +48,7 @@ public class ResultsController extends HcyBaseController {
|
|||
/**
|
||||
* 查询成绩列表
|
||||
*/
|
||||
@ApiOperation("查询成绩列表")
|
||||
@PreAuthorize("@ss.hasPermi('test:results:list')")
|
||||
@GetMapping("/list")
|
||||
public Serializable list(Results results) {
|
||||
|
|
@ -65,6 +69,7 @@ public class ResultsController extends HcyBaseController {
|
|||
/**
|
||||
* 导出成绩列表
|
||||
*/
|
||||
@ApiOperation("导出成绩列表")
|
||||
@PreAuthorize("@ss.hasPermi('test:results:export')")
|
||||
@Log(title = "成绩", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
|
|
@ -86,6 +91,8 @@ public class ResultsController extends HcyBaseController {
|
|||
/**
|
||||
* 获取成绩详细信息
|
||||
*/
|
||||
@ApiOperation("获取成绩详细信息")
|
||||
@ApiImplicitParam(name = "id" , value = "成绩id" , required = true, dataType = "Long" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('test:results:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
|
|
@ -105,6 +112,8 @@ public class ResultsController extends HcyBaseController {
|
|||
/**
|
||||
* 新增成绩
|
||||
*/
|
||||
@ApiOperation("新增成绩")
|
||||
@ApiImplicitParam(name = "results" , value = "新增成绩信息" , dataType = "Results")
|
||||
@PreAuthorize("@ss.hasPermi('test:results:add')")
|
||||
@Log(title = "成绩", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -134,6 +143,8 @@ public class ResultsController extends HcyBaseController {
|
|||
/**
|
||||
* 修改成绩
|
||||
*/
|
||||
@ApiOperation("修改成绩")
|
||||
@ApiImplicitParam(name = "results" , value = "修改成绩信息" , dataType = "Results")
|
||||
@PreAuthorize("@ss.hasPermi('test:results:edit')")
|
||||
@Log(title = "成绩", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -164,6 +175,8 @@ public class ResultsController extends HcyBaseController {
|
|||
/**
|
||||
* 删除成绩
|
||||
*/
|
||||
@ApiOperation("删除成绩")
|
||||
@ApiImplicitParam(name = "ids" , value = "成绩ids" , required = true, dataType = "Long" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('test:results:remove')")
|
||||
@Log(title = "成绩", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.hchyun.test.entity.Results;
|
|||
* 成绩Mapper接口
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-23
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public interface ResultsDao
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.hchyun.test.entity;
|
|||
|
||||
import com.hchyun.common.annotation.Excel;
|
||||
import com.hchyun.common.core.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
|
@ -9,29 +11,35 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
* 成绩对象 sys_results
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-23
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@ApiModel("成绩")
|
||||
public class Results extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
/** 学生id */
|
||||
@Excel(name = "学生id")
|
||||
@ApiModelProperty("学生id")
|
||||
private Long sId;
|
||||
|
||||
/** java成绩 */
|
||||
@Excel(name = "java成绩")
|
||||
@ApiModelProperty("java成绩")
|
||||
private Long java;
|
||||
|
||||
/** 图片路径 */
|
||||
@Excel(name = "图片路径")
|
||||
@ApiModelProperty("图片路径")
|
||||
private String images;
|
||||
|
||||
/** 文件路径 */
|
||||
@Excel(name = "文件路径")
|
||||
@ApiModelProperty("文件路径")
|
||||
private String file;
|
||||
|
||||
public void setId(Long id)
|
||||
|
|
@ -43,16 +51,16 @@ public class Results extends BaseEntity
|
|||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getsId() {
|
||||
return sId;
|
||||
}
|
||||
|
||||
public void setsId(Long sId) {
|
||||
public void setsId(Long sId)
|
||||
{
|
||||
this.sId = sId;
|
||||
}
|
||||
|
||||
public void setJava(Long java)
|
||||
public Long getsId()
|
||||
{
|
||||
return sId;
|
||||
}
|
||||
public void setJava(Long java)
|
||||
{
|
||||
this.java = java;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import com.hchyun.test.entity.Results;
|
|||
* 成绩Service接口
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-23
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public interface ResultsService
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import com.hchyun.test.service.ResultsService;
|
|||
* 成绩Service业务层处理
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-23
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@Service
|
||||
public class ResultsServiceImpl implements ResultsService {
|
||||
|
|
|
|||
Loading…
Reference in New Issue