Commit 80730267 authored by liuyang's avatar liuyang

提问后返回问题ID

parent 5782105c
...@@ -107,7 +107,7 @@ public class QAService { ...@@ -107,7 +107,7 @@ public class QAService {
* @param model * @param model
*/ */
@Transactional @Transactional
public void ask(AskModel model) { public Long ask(AskModel model) {
QuestionPO questionPO = new QuestionPO(); QuestionPO questionPO = new QuestionPO();
questionPO.setUserId(UserContext.getUserId()); questionPO.setUserId(UserContext.getUserId());
questionPO.setCourseId(model.getCourseId()); questionPO.setCourseId(model.getCourseId());
...@@ -121,7 +121,7 @@ public class QAService { ...@@ -121,7 +121,7 @@ public class QAService {
answerPO.setType(AnswerTypeEnum.USER); answerPO.setType(AnswerTypeEnum.USER);
answerPO.setContent(questionPO.getContent()); answerPO.setContent(questionPO.getContent());
answerMapper.insert(answerPO); answerMapper.insert(answerPO);
return questionPO.getId();
} }
/** /**
......
...@@ -27,9 +27,9 @@ public class FrontendQAController { ...@@ -27,9 +27,9 @@ public class FrontendQAController {
@SysLog("提问") @SysLog("提问")
@PostMapping("/ask") @PostMapping("/ask")
@RequiresRoles(value = {BizConstants.ROLE_USER,BizConstants.ROLE_ENTERPRISE_ADMIN},logical = Logical.OR) @RequiresRoles(value = {BizConstants.ROLE_USER,BizConstants.ROLE_ENTERPRISE_ADMIN},logical = Logical.OR)
public Result<String> ask(@RequestBody @Validated AskModel model){ public Result<Long> ask(@RequestBody @Validated AskModel model){
qaService.ask(model); Long id = qaService.ask(model);
return Result.succeed("ok"); return Result.succeed(id);
} }
@ApiOperation("我的提问列表") @ApiOperation("我的提问列表")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment