swagger配置

hehai
shijie 4 years ago
parent 79697e1cb8
commit ce2b17a796
  1. 2
      src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java
  2. 21
      src/main/java/com/msdw/tms/api/QuestionsControllerApi.java
  3. 15
      src/main/java/com/msdw/tms/common/utils/Constant.java
  4. 17
      src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java
  5. 4
      src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java
  6. 15
      src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java
  7. 4
      src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java
  8. 23
      src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java

@ -29,5 +29,5 @@ public interface EvaluationRulesControllerApi {
* 修改测评规则信息
*/
@ApiOperation(value = "修改测评规则信息", notes = "修改测评规则信息")
R update(@RequestBody EvaluationRulesEntity evaluationRules);
R update(EvaluationRulesEntity evaluationRules);
}

@ -6,8 +6,7 @@ import com.msdw.tms.entity.request.QuestionsQueryRequest;
import com.msdw.tms.entity.request.QuestionsUpdateRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
@ -29,45 +28,45 @@ public interface QuestionsControllerApi {
* 列表
*/
@ApiOperation(value = "分页加条件查询试题信息", notes = "分页加条件查询试题信息")
R list(@RequestParam Integer page,
@RequestParam Integer size,
R list(@ApiParam(name = "page", value = "页码", required = true) Integer page,
@ApiParam(name = "size", value = "每页显示的数据条数", required = true) Integer size,
QuestionsQueryRequest request);
/**
* 信息
*/
@ApiOperation(value = "根据试题id查询试题详情信息", notes = "根据试题id查询试题详情信息")
R info(@PathVariable("id") Integer id);
R info(@ApiParam(name = "id", value = "试题主键", required = true) Integer id);
/**
* 保存
*/
@ApiOperation(value = "新增一道试题", notes = "传入新增试题所需相关参数")
R save(@RequestBody QuestionsAddRequest questions);
R save(QuestionsAddRequest questions);
/**
* 根据试题id修改试题信息
*/
@ApiOperation(value = "根据试题id修改试题信息", notes = "根据试题id修改试题信息")
R update(@RequestBody QuestionsUpdateRequest questions);
R update(QuestionsUpdateRequest questions);
/**
* 是否禁用试题
*/
@ApiOperation(value = "是否禁用试题", notes = "是否禁用试题")
R isnable(Integer id);
R isnable(@ApiParam(name = "id", value = "试题主键", required = true) Integer id);
/**
* 删除
*/
@ApiOperation(value = "批量删除试题信息", notes = "批量删除试题信息")
R delete(@RequestBody Integer[] ids);
R delete(@ApiParam(name = "ids", value = "试题主键列表", required = true) Integer[] ids);
/**
* 通过excel批量导入
*/
@ApiOperation(value = "通过excel批量导入", notes = "通过excel批量导入")
R importQuestion(@RequestParam(name = "file") MultipartFile file) throws IOException;
R importQuestion(@ApiParam(name = "file", value = "excel文件", required = true) MultipartFile file) throws IOException;
/**
* excel模板文件上传
@ -76,7 +75,7 @@ public interface QuestionsControllerApi {
* @return
*/
@ApiOperation(value = "excel模板文件上传", notes = "excel模板文件上传")
R uploadFiles(MultipartFile file) throws IOException;
R uploadFiles(@ApiParam(name = "file", value = "excel文件", required = true) MultipartFile file) throws IOException;
/**
* excel模板文件下载

@ -204,7 +204,6 @@ public class Constant {
}
}
/**
* 是否删除
*/
@ -323,18 +322,4 @@ public class Constant {
}
}
// public static void main(String[] args) {
// String answer = "A";
//// System.out.println(answer.length());//3
//// System.out.println(answer.charAt(2));//E
//
// String str = "";
// for (int i = 0; i < answer.length(); i++) {
// char c = answer.charAt(i);
// str += c + ",";
// }
// str = str.substring(0, str.length() - 1);
// System.out.println(str);
// }
}

@ -1,10 +1,9 @@
package com.msdw.tms.entity.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 试题的基本信息表
*
@ -13,49 +12,61 @@ import java.util.List;
* @date 2020-08-14 16:05:06
*/
@Data
@ApiModel(value = "QuestionsAddRequest", description = "添加试题请求体对象")
public class QuestionsAddRequest {
/**
* 题型名称
*/
@ApiModelProperty(value = "题型名称", name = "questionType", example = "单选题", required = true)
private String questionType;
/**
* 题干信息
*/
@ApiModelProperty(value = "题干信息", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = true)
private String questionStem;
/**
* A选项内容
*/
@ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼", required = false)
private String optionA;
/**
* B选项内容
*/
@ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼", required = false)
private String optionB;
/**
* C选项内容
*/
@ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马", required = false)
private String optionC;
/**
* D选项内容
*/
@ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子", required = false)
private String optionD;
/**
* E选项内容
*/
@ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象", required = false)
private String optionE;
/**
* F选项内容
*/
@ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎", required = false)
private String optionF;
/**
* 正确答案
*/
@ApiModelProperty(value = "正确答案", name = "answer", example = "A", required = true)
private String answer;
/**
* 答案解析
*/
@ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物", required = false)
private String answerAnalysis;
/**
* 试题科目
*/
@ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识", required = false)
private String subjects;
}

@ -1,5 +1,7 @@
package com.msdw.tms.entity.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -10,11 +12,13 @@ import lombok.Data;
* @date 2020-08-14 16:05:06
*/
@Data
@ApiModel(value = "QuestionsQueryRequest", description = "条件查询请求对象")
public class QuestionsQueryRequest {
/**
* 题干问题描述
*/
@ApiModelProperty(value = "题干,问题描述", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = false)
private String questionStem;
// /**

@ -1,5 +1,7 @@
package com.msdw.tms.entity.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -10,53 +12,66 @@ import lombok.Data;
* @date 2020-08-14 16:05:06
*/
@Data
@ApiModel(value = "QuestionsUpdateRequest", description = "修改试题请求体对象")
public class QuestionsUpdateRequest {
/**
* 主键
*/
@ApiModelProperty(value = "主键", name = "id", example = "1", required = true)
private Integer id;
/**
* 题型名称
*/
@ApiModelProperty(value = "题型名称", name = "questionType", example = "单选题", required = true)
private String questionType;
/**
* 题干信息
*/
@ApiModelProperty(value = "题干信息", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = true)
private String questionStem;
/**
* A选项内容
*/
@ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼", required = false)
private String optionA;
/**
* B选项内容
*/
@ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼", required = false)
private String optionB;
/**
* C选项内容
*/
@ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马", required = false)
private String optionC;
/**
* D选项内容
*/
@ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子", required = false)
private String optionD;
/**
* E选项内容
*/
@ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象", required = false)
private String optionE;
/**
* F选项内容
*/
@ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎", required = false)
private String optionF;
/**
* 正确答案
*/
@ApiModelProperty(value = "正确答案", name = "answer", example = "A", required = true)
private String answer;
/**
* 答案解析
*/
@ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物", required = false)
private String answerAnalysis;
/**
* 试题科目
*/
@ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识", required = false)
private String subjects;
}

@ -1,7 +1,5 @@
package com.msdw.tms.entity.vo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@ -22,7 +20,7 @@ public class QuestionsDetailVO implements Serializable {
*/
private Integer id;
/**
* 题型号用于区分是什么题型
* 题型号用于区分是什么题型1单选2多选3判断
*/
private Integer questionTypeNo;
/**

@ -71,14 +71,14 @@ public class QuestionsServiceImpl extends ServiceImpl<QuestionsDao, QuestionsEnt
if (request.getQuestionStem() != null) {
queryWrapper.like("question_stem", request.getQuestionStem());
}
// 题型:判断题型是否为空,不为空则加入搜索条件
// if (questionsRequest.getQuestionType() != null) {
// queryWrapper.eq("question_type", questionsRequest.getQuestionType());
// }
// 修改时间:判断修改时间是否为空,不为空则加入搜索条件
// if (questionsRequest.getModifyTime() != null) {
// queryWrapper.eq("modify_time", questionsRequest.getModifyTime());
// }
// 题型:判断题型是否为空,不为空则加入搜索条件
// if (questionsRequest.getQuestionType() != null) {
// queryWrapper.eq("question_type", questionsRequest.getQuestionType());
// }
// 修改时间:判断修改时间是否为空,不为空则加入搜索条件
// if (questionsRequest.getModifyTime() != null) {
// queryWrapper.eq("modify_time", questionsRequest.getModifyTime());
// }
}
//修改时间降序
@ -89,6 +89,13 @@ public class QuestionsServiceImpl extends ServiceImpl<QuestionsDao, QuestionsEnt
queryWrapper
);
// PageUtils questionsPage = new PageUtils(questionsEntityIPage);
// List<QuestionsEntity> list = (List<QuestionsEntity>) questionsPage.getList();
//
// list.stream().map(item -> {
//
// })
return new PageUtils(questionsEntityIPage);
}

Loading…
Cancel
Save