浏览代码

学习计划

change 4 年之前
父节点
当前提交
be319c0ef0

+ 2 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/bank/ExamController.java

@@ -90,8 +90,8 @@ public class ExamController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:exam:add')")
     @Log(title = "试卷", businessType = BusinessType.INSERT)
     @PostMapping()
-    public AjaxResult<Void> add(@RequestBody ExamAddBo bo) {
-        return toAjax(iExamService.insertByAddBo(bo) ? 1 : 0);
+    public AjaxResult<ExamVo> add(@RequestBody ExamAddBo bo) {
+        return AjaxResult.success(iExamService.insertByAddBo(bo));
     }
 
     /**

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java

@@ -34,7 +34,7 @@ public interface IExamService extends IService<Exam> {
 	 * @param bo 试卷新增业务对象
 	 * @return
 	 */
-	Boolean insertByAddBo(ExamAddBo bo);
+	ExamVo insertByAddBo(ExamAddBo bo);
 
 	/**
 	 * 根据编辑业务对象修改试卷

+ 5 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -16,6 +16,7 @@ import com.zhongzheng.modules.bank.vo.ExamVo;
 import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
 import com.zhongzheng.modules.course.domain.CourseChapterSection;
 import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
+import com.zhongzheng.modules.user.domain.User;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -96,7 +97,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean insertByAddBo(ExamAddBo bo) {
+    public ExamVo insertByAddBo(ExamAddBo bo) {
         Exam add = BeanUtil.toBean(bo, Exam.class);
         add.setCode(ServletUtils.getEncoded("SJ"));
         validEntityBeforeSave(add);
@@ -127,7 +128,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             }
             iQuestionBusinessService.saveBatch(coll);
         }
-        return result;
+        ExamVo examVo = BeanUtil.toBean(this.getOne(new LambdaQueryWrapper<Exam>()
+                .eq(Exam::getExamId, add.getExamId()).last("limit 1")), ExamVo.class);
+        return examVo;
     }
 
     @Override