Commit 7735e76c authored by 王飞's avatar 王飞

Feat

1、增加swagger。

Reference N/A
parent 99f4e7a0
......@@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
......@@ -12,6 +15,7 @@ import lombok.experimental.Accessors;
* 审查场景变更任务
* @TableName t_review_scene_change_task
*/
@ApiModel(value = "ReviewSceneChangeTask", description = "场景变更任务")
@TableName(value ="t_review_scene_change_task")
@Accessors(chain = true)
@Data
......@@ -45,102 +49,122 @@ public class ReviewSceneChangeTask {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 任务编号
*/
@ApiModelProperty("任务编号")
private String taskNo;
/**
* 章节
*/
@ApiModelProperty("章节")
private String chapter;
/**
* 审查标准id
*/
@ApiModelProperty("审查标准id")
private Long standardId;
/**
* 审查标准
*/
@ApiModelProperty("审查标准")
private String standard;
/**
* 审查要点id
*/
@ApiModelProperty("审查要点id")
private Long keypointId;
/**
* 审查要点
*/
@ApiModelProperty("审查要点")
private String keypoint;
/**
* 审查细则id
*/
@ApiModelProperty("审查细则id")
private Long detailsId;
/**
* 审查细则
*/
@ApiModelProperty("审查细则")
private String details;
/**
* 操作(ADD DELETE UPDATE)
* 操作 [ADD DELETE UPDATE]
*/
@ApiModelProperty(value = "操作" , notes = "[ADD DELETE UPDATE]")
private String operation;
/**
* 当 operation 为 ADD 时该字段为空
*/
@ApiModelProperty(value = "场景旧值", notes = "当 operation 为 ADD 时该字段为空")
private String oldText;
/**
* 当 operation 为 DELETE 时该字段为空
*/
@ApiModelProperty(value = "场景新值", notes = "当 operation 为 DELETE 时该字段为空")
private String newText;
/**
* 任务发起人姓名
*/
@ApiModelProperty("任务发起人姓名")
private String taskInitiator;
/**
* 任务发起人部门
*/
@ApiModelProperty("任务发起人部门")
private String taskInitiatorDept;
/**
* 任务发起人Id
*/
@ApiModelProperty("任务发起人Id")
private Long taskInitiatorId;
/**
* 任务状态(PENDING、FINISH、CLOSE)
* 任务状态 [PENDING、FINISH、CLOSE]
*/
@ApiModelProperty(value = "任务状态", notes = "[PENDING、FINISH、CLOSE]")
private String taskStatus;
/**
* 任务结果(PASS、REJECT)
* 任务结果 [PASS、REJECT]
*/
@ApiModelProperty(value = "任务结果", notes = "[PASS、REJECT]")
private String taskResult;
/**
* 任务开始时间
*/
@ApiModelProperty("任务开始时间")
private Date taskBeginTime;
/**
* 任务结束时间
*/
@ApiModelProperty("任务结束时间")
private Date taskEndTime;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
......@@ -148,6 +172,7 @@ public class ReviewSceneChangeTask {
* 若为修改、删除任务时,此id在创建任务时赋值
* 若为新增任务时,此id在审批通过并保存新场景后赋值
*/
@ApiModelProperty(value = "审查场景id", notes = "1.若为修改、删除任务时,此id在创建任务时赋值; 2.若为新增任务时,此id在审批通过并保存新场景后赋值 ")
private Long reviewSceneId;
}
......@@ -9,6 +9,8 @@ import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.web.request.ReviewSceneChangeTaskCreateRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
......@@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Api("场景变更任务")
@RestController
@RequestMapping("/review/scene/change/task")
public class ReviewSceneChangeTaskController extends BaseController {
......@@ -26,6 +29,7 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
@ApiOperation("新建场景变更任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "场景变更任务", businessType = BusinessType.INSERT)
......@@ -43,10 +47,11 @@ public class ReviewSceneChangeTaskController extends BaseController {
* 根据用户ID查询待办列表
* @return
*/
@ApiOperation("根据用户ID查询待办列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findPending")
public TableDataInfo findPending() {
public TableDataInfo<ReviewSceneChangeTask> findPending() {
startPage();
return getDataTable(reviewSceneChangeTaskService.findPendingListByUserId(getUserId()));
}
......@@ -55,10 +60,11 @@ public class ReviewSceneChangeTaskController extends BaseController {
* 根据用户ID查询已办列表
* @return
*/
@ApiOperation("根据用户ID查询已办列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findFinish")
public TableDataInfo findFinish() {
public TableDataInfo<ReviewSceneChangeTask> findFinish() {
startPage();
return getDataTable(reviewSceneChangeTaskService.findFinishListByUserId(getUserId()));
}
......@@ -67,10 +73,11 @@ public class ReviewSceneChangeTaskController extends BaseController {
* 查询当前用户发布的任务
* @return
*/
@ApiOperation("查询当前用户发布的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findCreate")
public TableDataInfo findCreate() {
public TableDataInfo<ReviewSceneChangeTask> findCreate() {
startPage();
return getDataTable(reviewSceneChangeTaskService.findCreateListByUserId(getUserId()));
}
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "ReviewSceneChangeTaskCreateRequest", description = "新建场景")
@Data
public class ReviewSceneChangeTaskCreateRequest {
/**
* 章节
*/
@ApiModelProperty("章节")
private String chapter;
/**
* 审查标准id
*/
@ApiModelProperty("审查标准id")
private Long standardId;
/**
* 审查标准
*/
@ApiModelProperty("审查标准")
private String standard;
/**
* 审查要点id
*/
@ApiModelProperty("审查要点id")
private Long keypointId;
/**
* 审查要点
*/
@ApiModelProperty("审查要点")
private String keypoint;
/**
* 审查细则id
*/
@ApiModelProperty("审查细则id")
private Long detailsId;
/**
* 审查细则
*/
@ApiModelProperty("审查细则")
private String details;
/**
* 操作(ADD DELETE UPDATE)
*/
@ApiModelProperty(value = "操作" , notes = "[ADD DELETE UPDATE]")
private String operation;
/**
* 当 operation 为 ADD 时该字段为空
*/
@ApiModelProperty(value = "场景旧值", notes = "当 operation 为 ADD 时该字段为空")
private String oldText;
/**
* 当 operation 为 DELETE 时该字段为空
*/
@ApiModelProperty(value = "场景新值", notes = "当 operation 为 DELETE 时该字段为空")
private String newText;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
......@@ -65,6 +79,7 @@ public class ReviewSceneChangeTaskCreateRequest {
* 若为修改、删除任务时,此id在创建任务时赋值
* 若为新增任务时,此id在审批通过并保存新场景后赋值
*/
@ApiModelProperty(value = "审查场景id", notes = "1.若为修改、删除任务时,此id在创建任务时赋值; 2.若为新增任务时,此id在审批通过并保存新场景后赋值 ")
private Long reviewSceneId;
}
......@@ -134,7 +134,7 @@ swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
pathMapping: /
# 防止XSS攻击
xss:
......
......@@ -152,6 +152,12 @@
<version>8.2.1</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -79,8 +79,7 @@ public class BaseController
/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
protected <T> TableDataInfo<T> getDataTable(List<T> list)
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
......
package com.ruoyi.common.core.domain;
import java.util.HashMap;
import java.util.Objects;
import java.io.Serializable;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.StringUtils;
......@@ -10,19 +10,33 @@ import com.ruoyi.common.utils.StringUtils;
*
* @author ruoyi
*/
public class AjaxResult extends HashMap<String, Object>
public class AjaxResult<T> implements Serializable
{
private static final long serialVersionUID = 1L;
/** 状态码 */
public static final String CODE_TAG = "code";
/** 返回内容 */
public static final String MSG_TAG = "msg";
/** 数据对象 */
public static final String DATA_TAG = "data";
/**
* 是否成功 true or false
*/
private boolean success;
/**
* 状态码
*/
private int code;
/**
* 返回内容
*/
private String msg;
/**
* 数据对象
*/
private T data;
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
......@@ -32,36 +46,45 @@ public class AjaxResult extends HashMap<String, Object>
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态
*
* @param code 错误
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
public AjaxResult(int code, String msg, T data) {
this.code = code;
this.msg = msg;
if (StringUtils.isNotNull(data)) {
this.data = data;
}
if (code == HttpStatus.SUCCESS) {
this.success = Boolean.TRUE;
} else {
this.success = Boolean.FALSE;
}
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态
*
* @param code 错误
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, Object data)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data))
{
super.put(DATA_TAG, data);
public AjaxResult(int code, String msg) {
this.code = code;
this.msg = msg;
if (code == HttpStatus.SUCCESS) {
this.success = Boolean.TRUE;
} else {
this.success = Boolean.FALSE;
}
}
/**
* 返回成功消息
*
*
* @return 成功消息
*/
public static AjaxResult success()
......@@ -71,17 +94,17 @@ public class AjaxResult extends HashMap<String, Object>
/**
* 返回成功数据
*
*
* @return 成功消息
*/
public static AjaxResult success(Object data)
public static <U> AjaxResult<U> success(U data)
{
return AjaxResult.success("操作成功", data);
}
/**
* 返回成功消息
*
*
* @param msg 返回内容
* @return 成功消息
*/
......@@ -92,12 +115,12 @@ public class AjaxResult extends HashMap<String, Object>
/**
* 返回成功消息
*
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult success(String msg, Object data)
public static <U> AjaxResult<U> success(String msg, U data)
{
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
......@@ -120,15 +143,15 @@ public class AjaxResult extends HashMap<String, Object>
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult warn(String msg, Object data)
public static <U> AjaxResult<U> warn(String msg, U data)
{
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/**
* 返回错误消息
*
* @return 错误消息
*
* @return
*/
public static AjaxResult error()
{
......@@ -137,9 +160,9 @@ public class AjaxResult extends HashMap<String, Object>
/**
* 返回错误消息
*
*
* @param msg 返回内容
* @return 错误消息
* @return 警告消息
*/
public static AjaxResult error(String msg)
{
......@@ -148,70 +171,56 @@ public class AjaxResult extends HashMap<String, Object>
/**
* 返回错误消息
*
*
* @param msg 返回内容
* @param data 数据对象
* @return 错误消息
* @return 警告消息
*/
public static AjaxResult error(String msg, Object data)
public static <U> AjaxResult<U> error(String msg, U data)
{
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
* 返回错误消息
*
* @param code 状态
* @param msg 返回内容
* @return 错误消息
*
* @param code 响应
* @param msg 响应消息
* @return 警告消息
*/
public static AjaxResult error(int code, String msg)
public static <U> AjaxResult<U> error(int code, String msg)
{
return new AjaxResult(code, msg, null);
return new AjaxResult(code, msg);
}
/**
* 是否为成功消息
* 方便链式调用
*
* @return 结果
* @param key 键
* @param value 值
* @return 数据对象
*/
public boolean isSuccess()
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
@Deprecated
public AjaxResult put(String key, Object value) {
//super.put(key, value);
return this;
}
/**
* 是否为警告消息
* 是否为成功消息
*
* @return 结果
*/
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
public boolean isSuccess() {
return success;
}
/**
* 是否为错误消息
*
* @return 结果
*/
public boolean isError()
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
public String getMsg() {
return msg;
}
/**
* 方便链式调用
*
* @param key 键
* @param value 值
* @return 数据对象
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
public Integer getCode() {
return code;
}
}
......@@ -8,76 +8,63 @@ import java.util.List;
*
* @author ruoyi
*/
public class TableDataInfo implements Serializable
public class TableDataInfo<T> implements Serializable
{
private static final long serialVersionUID = 1L;
/** 总记录数 */
private long total;
/** 列表数据 */
private List<?> rows;
private List<T> rows;
/** 消息状态码 */
private int code;
/** 消息内容 */
private String msg;
/**
* 表格数据对象
*/
public TableDataInfo()
{
}
/**
* 分页
*
*
* @param list 列表数据
* @param total 总记录数
*/
public TableDataInfo(List<?> list, int total)
public TableDataInfo(List<T> list, int total)
{
this.rows = list;
this.total = total;
}
public long getTotal()
{
return total;
}
public void setTotal(long total)
{
this.total = total;
}
public List<?> getRows()
public List<T> getRows()
{
return rows;
}
public void setRows(List<?> rows)
public void setRows(List<T> rows)
{
this.rows = rows;
}
public int getCode()
{
return code;
}
public void setCode(int code)
{
this.code = code;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment