2023-08-11 11:51:09 +08:00
|
|
|
package com.jwl.driver.server.controller;
|
|
|
|
|
|
|
|
|
2023-08-14 01:31:26 +08:00
|
|
|
import com.jwl.driver.server.dto.QuestionQueryDto;
|
|
|
|
import com.jwl.driver.server.exception.BusinessException;
|
|
|
|
import com.jwl.driver.server.response.BaseResponse;
|
|
|
|
import com.jwl.driver.server.service.ITdQuestionService;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
2023-08-11 11:51:09 +08:00
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
2023-08-14 01:31:26 +08:00
|
|
|
import java.util.Objects;
|
|
|
|
|
2023-08-11 11:51:09 +08:00
|
|
|
/**
|
|
|
|
* <p>
|
|
|
|
* 题库; 前端控制器
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @author Automated procedures
|
|
|
|
* @since 2023-08-10
|
|
|
|
*/
|
2023-08-14 01:31:26 +08:00
|
|
|
@Api(tags = "考试题库")
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/tdQuestion")
|
|
|
|
@Slf4j
|
2023-08-11 11:51:09 +08:00
|
|
|
public class TdQuestionController {
|
|
|
|
|
2023-08-14 01:31:26 +08:00
|
|
|
@Autowired
|
|
|
|
private ITdQuestionService tdQuestionService;
|
|
|
|
|
|
|
|
@ApiOperation("根据id获取题目")
|
|
|
|
@PostMapping("/queryQuestionById")
|
2023-08-15 01:37:50 +08:00
|
|
|
public BaseResponse queryQuestionById(@RequestBody QuestionQueryDto queryDto) {
|
2023-08-14 01:31:26 +08:00
|
|
|
log.info("获取题型======>queryDto:{}", queryDto);
|
|
|
|
return BaseResponse.success(tdQuestionService.queryQuestionById(queryDto));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("根据id列表获取题目")
|
|
|
|
@PostMapping("/queryQuestionByIdList")
|
2023-08-15 01:37:50 +08:00
|
|
|
public BaseResponse queryQuestionByIdList(@RequestBody QuestionQueryDto queryDto) {
|
2023-08-14 01:31:26 +08:00
|
|
|
log.info("获取题型======>queryDto:{}", queryDto);
|
|
|
|
return BaseResponse.success(tdQuestionService.queryQuestionByIdList(queryDto));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("根据查询条件获取题目")
|
|
|
|
@PostMapping("/queryQuestion")
|
2023-08-15 01:37:50 +08:00
|
|
|
public BaseResponse queryQuestion(@RequestBody QuestionQueryDto queryDto) {
|
2023-08-14 01:31:26 +08:00
|
|
|
log.info("获取题型======>queryDto:{}", queryDto);
|
|
|
|
return BaseResponse.success(tdQuestionService.queryQuestion(queryDto));
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("获取模拟考试题目")
|
|
|
|
@PostMapping("/getTestQuestion")
|
2023-08-15 01:37:50 +08:00
|
|
|
public BaseResponse getTestQuestion(@RequestBody QuestionQueryDto queryDto) {
|
2023-08-14 01:31:26 +08:00
|
|
|
log.info("获取模拟考试题目======>queryDto:{}", queryDto);
|
|
|
|
if (Objects.isNull(queryDto.getCarTypeId()) && Objects.isNull(queryDto.getSubject())){
|
|
|
|
throw new BusinessException("缺少必要参数");
|
|
|
|
}
|
|
|
|
return BaseResponse.success(tdQuestionService.getTestQuestion(queryDto));
|
|
|
|
}
|
2023-08-11 11:51:09 +08:00
|
|
|
}
|