新增题目时有题库id新增到题库,没有题库id只存入题目表

This commit is contained in:
Lqc 2025-09-05 20:12:21 +08:00
parent 978ba1ecd9
commit d9c60a21db

View File

@ -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<AiolQuestion, IAiolQuestionService> {
@Autowired
private IAiolQuestionService aiolQuestionService;
@Autowired
private AiolQuestionRepoController aiolQuestionRepoController;
/**
* 分页列表查询
@ -86,9 +91,16 @@ public class AiolQuestionController extends JeecgController<AiolQuestion, IAiolQ
@Operation(summary="题目-添加")
@RequiresPermissions("aiol:aiol_question:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody AiolQuestion aiolQuestion) {
@Transactional
public Result<String> 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("添加成功!");
}