diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolQuestionController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolQuestionController.java index 912e6420..e549de26 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolQuestionController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-aiol/src/main/java/org/jeecg/modules/aiol/controller/AiolQuestionController.java @@ -15,6 +15,8 @@ import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.aiol.entity.AiolQuestion; +import org.jeecg.modules.aiol.entity.AiolQuestionRepo; +import org.jeecg.modules.aiol.service.IAiolQuestionRepoService; import org.jeecg.modules.aiol.service.IAiolQuestionService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -29,6 +31,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; @@ -51,6 +54,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; public class AiolQuestionController extends JeecgController { @Autowired private IAiolQuestionService aiolQuestionService; + @Autowired + private AiolQuestionRepoController aiolQuestionRepoController; /** * 分页列表查询 @@ -86,9 +91,16 @@ public class AiolQuestionController extends JeecgController add(@RequestBody AiolQuestion aiolQuestion) { + @Transactional + public Result add(@RequestBody AiolQuestion aiolQuestion,@RequestParam String repoId) { aiolQuestionService.save(aiolQuestion); - + //题库题目添加 + if(repoId!=null&& !repoId.isEmpty()){ + AiolQuestionRepo aiolQuestionRepo = new AiolQuestionRepo(); + aiolQuestionRepo.setRepoId(repoId); + aiolQuestionRepo.setQuestionId(aiolQuestion.getId()); + aiolQuestionRepoController.add(aiolQuestionRepo); + } return Result.OK("添加成功!"); }