diff --git a/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java b/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java index 3e58609..ebafe18 100644 --- a/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java +++ b/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java @@ -29,5 +29,5 @@ public interface EvaluationRulesControllerApi { * 修改测评规则信息 */ @ApiOperation(value = "修改测评规则信息", notes = "修改测评规则信息") - R update(@RequestBody EvaluationRulesEntity evaluationRules); + R update(EvaluationRulesEntity evaluationRules); } diff --git a/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java b/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java index 4cbfaa8..ce25d72 100644 --- a/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java +++ b/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java @@ -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模板文件下载 diff --git a/src/main/java/com/msdw/tms/common/utils/Constant.java b/src/main/java/com/msdw/tms/common/utils/Constant.java index 80e4d2d..9562d95 100644 --- a/src/main/java/com/msdw/tms/common/utils/Constant.java +++ b/src/main/java/com/msdw/tms/common/utils/Constant.java @@ -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); -// } } \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java index 3949b36..5d3da9e 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java @@ -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; } diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java index bc7c3f0..635285d 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java @@ -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; // /** diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java index d86496c..defadbb 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java @@ -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; } diff --git a/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java b/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java index 182d643..e9426cc 100644 --- a/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java @@ -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; /** diff --git a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java index fe5e00a..4bc53cb 100644 --- a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java @@ -71,14 +71,14 @@ public class QuestionsServiceImpl extends ServiceImpl list = (List) questionsPage.getList(); +// +// list.stream().map(item -> { +// +// }) + return new PageUtils(questionsEntityIPage); }