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 = "修改测评规则信息") @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 com.msdw.tms.entity.request.QuestionsUpdateRequest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable; import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -29,45 +28,45 @@ public interface QuestionsControllerApi {
* 列表 * 列表
*/ */
@ApiOperation(value = "分页加条件查询试题信息", notes = "分页加条件查询试题信息") @ApiOperation(value = "分页加条件查询试题信息", notes = "分页加条件查询试题信息")
R list(@RequestParam Integer page, R list(@ApiParam(name = "page", value = "页码", required = true) Integer page,
@RequestParam Integer size, @ApiParam(name = "size", value = "每页显示的数据条数", required = true) Integer size,
QuestionsQueryRequest request); QuestionsQueryRequest request);
/** /**
* 信息 * 信息
*/ */
@ApiOperation(value = "根据试题id查询试题详情信息", notes = "根据试题id查询试题详情信息") @ApiOperation(value = "根据试题id查询试题详情信息", notes = "根据试题id查询试题详情信息")
R info(@PathVariable("id") Integer id); R info(@ApiParam(name = "id", value = "试题主键", required = true) Integer id);
/** /**
* 保存 * 保存
*/ */
@ApiOperation(value = "新增一道试题", notes = "传入新增试题所需相关参数") @ApiOperation(value = "新增一道试题", notes = "传入新增试题所需相关参数")
R save(@RequestBody QuestionsAddRequest questions); R save(QuestionsAddRequest questions);
/** /**
* 根据试题id修改试题信息 * 根据试题id修改试题信息
*/ */
@ApiOperation(value = "根据试题id修改试题信息", notes = "根据试题id修改试题信息") @ApiOperation(value = "根据试题id修改试题信息", notes = "根据试题id修改试题信息")
R update(@RequestBody QuestionsUpdateRequest questions); R update(QuestionsUpdateRequest questions);
/** /**
* 是否禁用试题 * 是否禁用试题
*/ */
@ApiOperation(value = "是否禁用试题", notes = "是否禁用试题") @ApiOperation(value = "是否禁用试题", notes = "是否禁用试题")
R isnable(Integer id); R isnable(@ApiParam(name = "id", value = "试题主键", required = true) Integer id);
/** /**
* 删除 * 删除
*/ */
@ApiOperation(value = "批量删除试题信息", notes = "批量删除试题信息") @ApiOperation(value = "批量删除试题信息", notes = "批量删除试题信息")
R delete(@RequestBody Integer[] ids); R delete(@ApiParam(name = "ids", value = "试题主键列表", required = true) Integer[] ids);
/** /**
* 通过excel批量导入 * 通过excel批量导入
*/ */
@ApiOperation(value = "通过excel批量导入", notes = "通过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模板文件上传 * excel模板文件上传
@ -76,7 +75,7 @@ public interface QuestionsControllerApi {
* @return * @return
*/ */
@ApiOperation(value = "excel模板文件上传", notes = "excel模板文件上传") @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模板文件下载 * 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; package com.msdw.tms.entity.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; 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 * @date 2020-08-14 16:05:06
*/ */
@Data @Data
@ApiModel(value = "QuestionsAddRequest", description = "添加试题请求体对象")
public class QuestionsAddRequest { public class QuestionsAddRequest {
/** /**
* 题型名称 * 题型名称
*/ */
@ApiModelProperty(value = "题型名称", name = "questionType", example = "单选题", required = true)
private String questionType; private String questionType;
/** /**
* 题干信息 * 题干信息
*/ */
@ApiModelProperty(value = "题干信息", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = true)
private String questionStem; private String questionStem;
/** /**
* A选项内容 * A选项内容
*/ */
@ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼", required = false)
private String optionA; private String optionA;
/** /**
* B选项内容 * B选项内容
*/ */
@ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼", required = false)
private String optionB; private String optionB;
/** /**
* C选项内容 * C选项内容
*/ */
@ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马", required = false)
private String optionC; private String optionC;
/** /**
* D选项内容 * D选项内容
*/ */
@ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子", required = false)
private String optionD; private String optionD;
/** /**
* E选项内容 * E选项内容
*/ */
@ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象", required = false)
private String optionE; private String optionE;
/** /**
* F选项内容 * F选项内容
*/ */
@ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎", required = false)
private String optionF; private String optionF;
/** /**
* 正确答案 * 正确答案
*/ */
@ApiModelProperty(value = "正确答案", name = "answer", example = "A", required = true)
private String answer; private String answer;
/** /**
* 答案解析 * 答案解析
*/ */
@ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物", required = false)
private String answerAnalysis; private String answerAnalysis;
/** /**
* 试题科目 * 试题科目
*/ */
@ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识", required = false)
private String subjects; private String subjects;
} }

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

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

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

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

Loading…
Cancel
Save