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