|
@@ -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>();
|