yangfeng il y a 1 an
Parent
commit
0350d572a0

+ 1 - 2
web/src/main/java/com/ynfy/buss/practice/userpractice/controller/UserPracticeController.java

@@ -179,8 +179,7 @@ public class UserPracticeController extends JeecgController<UserPractice, IUserP
     @ApiOperation(value = "提交练习")
     @PostMapping(value = "/submitPractice")
     public Result<?> submitPractice(@RequestBody UserPracticeDTO dto) {
-        userPracticeService.submitPractice(dto);
-        return Result.ok("提交练习成功!");
+        return Result.OK("提交练习成功!", userPracticeService.submitPractice(dto));
     }
 
 }

+ 1 - 1
web/src/main/java/com/ynfy/buss/practice/userpractice/service/IUserPracticeService.java

@@ -22,5 +22,5 @@ public interface IUserPracticeService extends IService<UserPractice> {
      */
     List<UserPractice> getRecentPractice();
 
-    void submitPractice(UserPracticeDTO dto);
+    String submitPractice(UserPracticeDTO dto);
 }

+ 2 - 1
web/src/main/java/com/ynfy/buss/practice/userpractice/service/impl/UserPracticeServiceImpl.java

@@ -53,7 +53,7 @@ public class UserPracticeServiceImpl extends ServiceImpl<UserPracticeMapper, Use
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void submitPractice(UserPracticeDTO dto) {
+    public String submitPractice(UserPracticeDTO dto) {
         if (CollectionUtils.isEmpty(dto.getQuestionList())) {
             throw new JeecgBootException("练习题目为空");
         }
@@ -107,5 +107,6 @@ public class UserPracticeServiceImpl extends ServiceImpl<UserPracticeMapper, Use
         if (!CollectionUtils.isEmpty(userPracticeQuestionList)) {
             userPracticeQuestionService.saveBatch(userPracticeQuestionList);
         }
+        return userPracticeId;
     }
 }