|
@@ -73,7 +73,7 @@ public class QuestionWrongController extends BaseController{
|
|
|
|
|
|
@PostMapping("wrongs")
|
|
|
@ApiOperation("合并本机和云端错题")
|
|
|
- public Response<Integer> wrongs(@RequestBody Long[] questionIds,Integer km){
|
|
|
+ public Response<Integer> wrongs(@RequestBody QuestionWrongYunDTO questionWrongYunDTO){
|
|
|
//查询该用户已收藏的题目列表
|
|
|
QuestionWrongListDTO dto = new QuestionWrongListDTO();
|
|
|
dto.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
|
|
@@ -81,13 +81,13 @@ public class QuestionWrongController extends BaseController{
|
|
|
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 (questionIdsStr.contains(qid+","+km)) {
|
|
|
+ for (Long qid : questionWrongYunDTO.getQuestionIds()) {
|
|
|
+ if (questionIdsStr.contains(qid+","+questionWrongYunDTO.getKm())) {
|
|
|
continue;
|
|
|
}
|
|
|
QuestionWrong questionWrong = new QuestionWrong();
|
|
|
questionWrong.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
|
|
|
- questionWrong.setKm(km);
|
|
|
+ questionWrong.setKm(questionWrongYunDTO.getKm());
|
|
|
questionWrong.setQuestionId(qid);
|
|
|
qlist.add(questionWrong);
|
|
|
}
|
|
@@ -100,20 +100,20 @@ public class QuestionWrongController extends BaseController{
|
|
|
|
|
|
@PostMapping("bakWrongs")
|
|
|
@ApiOperation("备份本机错题到云端")
|
|
|
- public Response<Integer> bakWrongs(@RequestBody Long[] questionIds,Integer km){
|
|
|
+ public Response<Integer> bakWrongs(@RequestBody QuestionWrongYunDTO questionWrongYunDTO){
|
|
|
//首先删除云端数据
|
|
|
Long userId = SecurityUtils.getLoginUser().getStudent().getId();
|
|
|
QueryWrapper<QuestionWrong> queryWrapper = new QueryWrapper<QuestionWrong>();
|
|
|
queryWrapper.eq("user_id",userId);
|
|
|
- queryWrapper.eq("km",km);
|
|
|
+ queryWrapper.eq("km",questionWrongYunDTO.getKm());
|
|
|
questionWrongService.remove(queryWrapper);
|
|
|
|
|
|
//保存上传的错题
|
|
|
List<QuestionWrong> qlist = new ArrayList<QuestionWrong>();
|
|
|
- for (Long qid : questionIds) {
|
|
|
+ for (Long qid : questionWrongYunDTO.getQuestionIds()) {
|
|
|
QuestionWrong questionWrong = new QuestionWrong();
|
|
|
questionWrong.setUserId(SecurityUtils.getLoginUser().getStudent().getId());
|
|
|
- questionWrong.setKm(km);
|
|
|
+ questionWrong.setKm(questionWrongYunDTO.getKm());
|
|
|
questionWrong.setQuestionId(qid);
|
|
|
qlist.add(questionWrong);
|
|
|
}
|