فهرست منبع

收藏错题接口修改

小么熊🐻 2 سال پیش
والد
کامیت
2991c124b1

+ 9 - 8
nbjk-admin/src/main/java/com/miaxis/app/controller/question/QuestionWrongController.java

@@ -73,16 +73,16 @@ public class QuestionWrongController extends BaseController{
 
     @PostMapping("wrongs")
     @ApiOperation("合并本机和云端错题")
-    public Response<Integer> wrongs(@RequestBody Long[] questionids,String km){
+    public Response<Integer> wrongs(@RequestBody Long[] questionIds,Integer km){
         //查询该用户已收藏的题目列表
         QuestionWrongListDTO dto = new QuestionWrongListDTO();
         dto.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
         List<QuestionWrong> dblist = questionWrongService.selectQuestionWrongList(dto);
-        List<String> questionIds = dblist.stream().map(o -> o.getQuestionId()+","+o.getKm()).collect(Collectors.toList());
+        List<String> questionIdsStr = dblist.stream().map(o -> o.getQuestionId()+","+o.getKm()).collect(Collectors.toList());
 
         List<QuestionWrong> qlist = new ArrayList<QuestionWrong>();
-        for (Long qid : questionids) {
-            if (questionIds.contains(qid+","+km)) {
+        for (Long qid : questionIds) {
+            if (questionIdsStr.contains(qid+","+km)) {
                 continue;
             }
             QuestionWrong questionWrong = new QuestionWrong();
@@ -100,7 +100,7 @@ public class QuestionWrongController extends BaseController{
 
     @PostMapping("bakWrongs")
     @ApiOperation("备份本机错题到云端")
-    public Response<Integer> bakWrongs(@RequestBody List<QuestionWrongDTO> list,Integer km){
+    public Response<Integer> bakWrongs(@RequestBody Long[] questionIds,Integer km){
         //首先删除云端数据
         Long userId = SecurityUtils.getLoginUser().getStudent().getId();
         QueryWrapper<QuestionWrong> queryWrapper = new QueryWrapper<QuestionWrong>();
@@ -110,10 +110,11 @@ public class QuestionWrongController extends BaseController{
 
         //保存上传的错题
         List<QuestionWrong> qlist = new ArrayList<QuestionWrong>();
-        for (QuestionWrongDTO questionWrongDTO : list) {
+        for (Long qid : questionIds) {
             QuestionWrong questionWrong = new QuestionWrong();
-            BeanUtils.copyProperties(questionWrongDTO, questionWrong);
             questionWrong.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
+            questionWrong.setKm(km);
+            questionWrong.setQuestionId(qid);
             qlist.add(questionWrong);
         }
         if (qlist.isEmpty()) {
@@ -129,7 +130,7 @@ public class QuestionWrongController extends BaseController{
     @ApiOperation("删除错题")
     public  Response<Integer> remove(
             @ApiParam(name = "questionId", value = "问题id", required = true)
-            @PathVariable String questionId
+            @PathVariable Long questionId
     ){
         Long userId = SecurityUtils.getLoginUser().getStudent().getId();
         QueryWrapper<QuestionWrong> queryWrapper= new QueryWrapper<QuestionWrong>();

+ 2 - 2
nbjk-service/src/main/java/com/miaxis/question/domain/QuestionWrong.java

@@ -45,8 +45,8 @@ public class QuestionWrong extends BaseBusinessEntity{
     /** 科目 */
     @Excel(name = "科目")
     @TableField("km")
-    @ApiModelProperty(value = "考试科目(科目一、科目二、科目三、科目四)")
-    private String km;
+    @ApiModelProperty(value = "考试科目(1、2、3、4)")
+    private Integer km;
 
 
 

+ 1 - 1
nbjk-service/src/main/java/com/miaxis/question/dto/QuestionWrongDTO.java

@@ -24,6 +24,6 @@ public class QuestionWrongDTO {
 
     /** 科目 */
     @ApiModelProperty(value = "考试科目(科目一、科目二、科目三、科目四)",required=true)
-    private String km;
+    private Integer km;
 
 }

+ 2 - 2
nbjk-service/src/main/java/com/miaxis/question/dto/QuestionWrongDelDTO.java

@@ -16,8 +16,8 @@ public class QuestionWrongDelDTO {
 
 
     /** 科目 */
-    @ApiModelProperty(value = "考试科目(科目一、科目二、科目三、科目四)")
-    private String km;
+    @ApiModelProperty(value = "考试科目(1、2、3、4)")
+    private Integer km;
 
 
 

+ 2 - 2
nbjk-service/src/main/java/com/miaxis/question/dto/QuestionWrongListDTO.java

@@ -21,8 +21,8 @@ public class QuestionWrongListDTO extends BaseBusinessEntity {
     private Long questionId;
 
     /** 科目 */
-    @ApiModelProperty(value = "考试科目(科目一、科目二、科目三、科目四)")
-    private String km;
+    @ApiModelProperty(value = "考试科目(1、2、3、4)")
+    private Integer km;