获取考试题目
parent
38d85ae195
commit
e3fbbe7922
|
@ -18,4 +18,25 @@ public class Constants {
|
|||
//是否有效-无效
|
||||
public static String IS_ACTIVE_FALSE = "1";
|
||||
|
||||
//科目一
|
||||
public static String SUBJECT_ONE = "1";
|
||||
|
||||
//科目二
|
||||
public static String SUBJECT_TWO = "2";
|
||||
|
||||
//科目三
|
||||
public static String SUBJECT_THREE = "3";
|
||||
|
||||
//科目四
|
||||
public static String SUBJECT_FOUR = "4";
|
||||
|
||||
//单选题
|
||||
public static String QUESTION_TYPE_ONE = "1";
|
||||
|
||||
//判断题
|
||||
public static String QUESTION_TYPE_TWO = "2";
|
||||
|
||||
//多选题
|
||||
public static String QUESTION_TYPE_THREE = "3";
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.response.BaseResponse;
|
||||
import com.jwl.driver.server.service.ITdCarService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -13,8 +23,19 @@ import org.springframework.stereotype.Controller;
|
|||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("//tdCar")
|
||||
@Api(tags = "车型")
|
||||
@RestController
|
||||
@RequestMapping("/tdCar")
|
||||
@Slf4j
|
||||
public class TdCarController {
|
||||
|
||||
@Autowired
|
||||
private ITdCarService carService;
|
||||
|
||||
@ApiOperation("获取车型列表")
|
||||
@GetMapping("/list")
|
||||
public BaseResponse list() {
|
||||
return BaseResponse.success(carService.list());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package com.jwl.driver.server.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
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.*;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库; 前端控制器
|
||||
|
@ -13,8 +23,45 @@ import org.springframework.stereotype.Controller;
|
|||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("//tdQuestion")
|
||||
@Api(tags = "考试题库")
|
||||
@RestController
|
||||
@RequestMapping("/tdQuestion")
|
||||
@Slf4j
|
||||
public class TdQuestionController {
|
||||
|
||||
@Autowired
|
||||
private ITdQuestionService tdQuestionService;
|
||||
|
||||
@ApiOperation("根据id获取题目")
|
||||
@PostMapping("/queryQuestionById")
|
||||
public BaseResponse queryQuestionById(@RequestParam QuestionQueryDto queryDto) {
|
||||
log.info("获取题型======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.queryQuestionById(queryDto));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据id列表获取题目")
|
||||
@PostMapping("/queryQuestionByIdList")
|
||||
public BaseResponse queryQuestionByIdList(@RequestParam QuestionQueryDto queryDto) {
|
||||
log.info("获取题型======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.queryQuestionByIdList(queryDto));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据查询条件获取题目")
|
||||
@PostMapping("/queryQuestion")
|
||||
public BaseResponse queryQuestion(@RequestParam QuestionQueryDto queryDto) {
|
||||
log.info("获取题型======>queryDto:{}", queryDto);
|
||||
return BaseResponse.success(tdQuestionService.queryQuestion(queryDto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取模拟考试题目")
|
||||
@PostMapping("/getTestQuestion")
|
||||
public BaseResponse getTestQuestion(@RequestParam QuestionQueryDto queryDto) {
|
||||
log.info("获取模拟考试题目======>queryDto:{}", queryDto);
|
||||
if (Objects.isNull(queryDto.getCarTypeId()) && Objects.isNull(queryDto.getSubject())){
|
||||
throw new BusinessException("缺少必要参数");
|
||||
}
|
||||
return BaseResponse.success(tdQuestionService.getTestQuestion(queryDto));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package com.jwl.driver.server.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库查询入参;
|
||||
* </p>
|
||||
*
|
||||
* @author Automated procedures
|
||||
* @since 2023-08-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("题目查询入参")
|
||||
public class QuestionQueryDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 题目标识
|
||||
*/
|
||||
@ApiModelProperty("题目标识")
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 题目标识列表
|
||||
*/
|
||||
@ApiModelProperty("题目标识列表")
|
||||
private List<Long> questionIdList;
|
||||
|
||||
/**
|
||||
* 题型分类
|
||||
*/
|
||||
@ApiModelProperty("题型分类")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 章节标识
|
||||
*/
|
||||
@ApiModelProperty("章节标识")
|
||||
private String chapter;
|
||||
|
||||
/**
|
||||
* 所属科目,1:科目1,2:科目4
|
||||
*/
|
||||
@ApiModelProperty("所属科目,1:科目1,2:科目4")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
@ApiModelProperty("车型")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 题型: 单选 多选 判断题
|
||||
*/
|
||||
@ApiModelProperty("题型: 单选 多选 判断题")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 专项练习类型
|
||||
*/
|
||||
@ApiModelProperty("专项练习类型")
|
||||
private String cid;
|
||||
|
||||
/**
|
||||
* 考点
|
||||
*/
|
||||
@ApiModelProperty("考点")
|
||||
private String point;
|
||||
|
||||
/**
|
||||
* 获取题数
|
||||
*/
|
||||
@ApiModelProperty("获取题数")
|
||||
private int Num;
|
||||
|
||||
}
|
|
@ -27,8 +27,8 @@ public class TdPointQuestion implements Serializable {
|
|||
/**
|
||||
* 考点标识
|
||||
*/
|
||||
@TableId(value = "POINT", type = IdType.AUTO)
|
||||
private Integer point;
|
||||
@TableField(value = "POINT")
|
||||
private String point;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -86,8 +88,8 @@ public class TdQuestion implements Serializable {
|
|||
/**
|
||||
* 未知
|
||||
*/
|
||||
@TableField("CID")
|
||||
private String cid;
|
||||
@TableField("CIDS")
|
||||
private String cids;
|
||||
|
||||
/**
|
||||
* 题型分类
|
||||
|
@ -137,6 +139,12 @@ public class TdQuestion implements Serializable {
|
|||
@TableField("TYPE")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 显示序号
|
||||
*/
|
||||
@TableField("SHOW_ORDER")
|
||||
private int showOrder;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package com.jwl.driver.server.mapper;
|
||||
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -13,4 +18,17 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface TdQuestionMapper extends BaseMapper<TdQuestion> {
|
||||
|
||||
/**
|
||||
* 查询考题
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QusetionVo> queryQuestion(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 随机查询考题
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QusetionVo> queryQuestionByRandom(@Param("queryDto") QuestionQueryDto queryDto);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.jwl.driver.server.service;
|
||||
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -13,4 +17,32 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface ITdQuestionService extends IService<TdQuestion> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据id 获取题目
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
TdQuestion queryQuestionById(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 根据id列表 批量获取题目
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<TdQuestion> queryQuestionByIdList(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 根据查询条件获取列表
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QusetionVo> queryQuestion(QuestionQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 获取考试题目
|
||||
* @param queryDto
|
||||
* @return
|
||||
*/
|
||||
List<QusetionVo> getTestQuestion(QuestionQueryDto queryDto);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
package com.jwl.driver.server.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jwl.driver.server.constant.Constants;
|
||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||
import com.jwl.driver.server.entity.TdQuestion;
|
||||
import com.jwl.driver.server.mapper.TdQuestionMapper;
|
||||
import com.jwl.driver.server.service.ITdQuestionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jwl.driver.server.service.ITdSysConfigService;
|
||||
import com.jwl.driver.server.vo.QusetionVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 题库; 服务实现类
|
||||
|
@ -17,4 +27,55 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuestion> implements ITdQuestionService {
|
||||
|
||||
@Autowired
|
||||
private ITdSysConfigService configService;
|
||||
|
||||
@Override
|
||||
public TdQuestion queryQuestionById(QuestionQueryDto queryDto) {
|
||||
return this.getBaseMapper().selectById(queryDto.getQuestionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TdQuestion> queryQuestionByIdList(QuestionQueryDto queryDto) {
|
||||
LambdaQueryWrapper<TdQuestion> queryWrapper = new LambdaQueryWrapper<TdQuestion>()
|
||||
.in(TdQuestion::getQuestionId,queryDto.getQuestionIdList());
|
||||
|
||||
return this.getBaseMapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QusetionVo> queryQuestion(QuestionQueryDto queryDto) {
|
||||
return this.getBaseMapper().queryQuestion(queryDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QusetionVo> getTestQuestion(QuestionQueryDto queryDto) {
|
||||
List<QusetionVo> resultList = new ArrayList<>();
|
||||
|
||||
if (StrUtil.equals(Constants.SUBJECT_ONE,queryDto.getSubject())){
|
||||
//40道判断题 60道单选 每题1分
|
||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||
.setNum(60);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
|
||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||
.setNum(40);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
|
||||
}else if(StrUtil.equals(Constants.SUBJECT_FOUR,queryDto.getSubject())){
|
||||
//20道判断题 20道单选 10道多选,每题2分,如果各车型不统一 可以配在数据库里
|
||||
queryDto.setType(Constants.QUESTION_TYPE_TWO)
|
||||
.setNum(20);
|
||||
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
queryDto.setType(Constants.QUESTION_TYPE_ONE)
|
||||
.setNum(20);
|
||||
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
queryDto.setType(Constants.QUESTION_TYPE_THREE)
|
||||
.setNum(10);
|
||||
resultList.addAll(this.getBaseMapper().queryQuestionByRandom(queryDto));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
package com.jwl.driver.server.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 驾考题目出参
|
||||
* @create 2023/8/13 17:13
|
||||
*/
|
||||
public class QusetionVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 题目标识
|
||||
*/
|
||||
@ApiModelProperty("题目标识")
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 题目内容
|
||||
*/
|
||||
@ApiModelProperty("题目内容")
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 选项A
|
||||
*/
|
||||
@ApiModelProperty("选项A")
|
||||
private String chooseA;
|
||||
|
||||
/**
|
||||
* 选项B
|
||||
*/
|
||||
@ApiModelProperty("选项B")
|
||||
private String chooseB;
|
||||
|
||||
/**
|
||||
* 选项C
|
||||
*/
|
||||
@ApiModelProperty("选项C")
|
||||
private String chooseC;
|
||||
|
||||
/**
|
||||
* 选项D
|
||||
*/
|
||||
@ApiModelProperty("选项D")
|
||||
private String chooseD;
|
||||
|
||||
/**
|
||||
* 选项E
|
||||
*/
|
||||
@ApiModelProperty("选项E")
|
||||
private String chooseE;
|
||||
|
||||
/**
|
||||
* 选项F
|
||||
*/
|
||||
@ApiModelProperty("选项F")
|
||||
private String chooseF;
|
||||
|
||||
/**
|
||||
* 选项G
|
||||
*/
|
||||
@ApiModelProperty("选项G")
|
||||
private String chooseG;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
@ApiModelProperty("正确答案")
|
||||
private String trueAnswer;
|
||||
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
@ApiModelProperty("未知")
|
||||
private String cids;
|
||||
|
||||
/**
|
||||
* 题型分类
|
||||
*/
|
||||
@ApiModelProperty("题型分类")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 题目图片url
|
||||
*/
|
||||
@ApiModelProperty("题目图片url")
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
@ApiModelProperty("未知")
|
||||
private String sohuImg;
|
||||
|
||||
/**
|
||||
* 最佳回答
|
||||
*/
|
||||
@ApiModelProperty("最佳回答")
|
||||
private String bestAnswer;
|
||||
|
||||
/**
|
||||
* 章节标识
|
||||
*/
|
||||
@ApiModelProperty("章节标识")
|
||||
private String chapter;
|
||||
|
||||
/**
|
||||
* 所属科目,1:科目1,2:科目4
|
||||
*/
|
||||
@ApiModelProperty("所属科目,1:科目1,2:科目4")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 选择
|
||||
*/
|
||||
@ApiModelProperty("选择")
|
||||
private String options;
|
||||
|
||||
/**
|
||||
* 题目类型,1:选择题 2:判断题,3:多选题
|
||||
*/
|
||||
@ApiModelProperty("题目类型,1:选择题 2:判断题,3:多选题")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 显示序号
|
||||
*/
|
||||
@ApiModelProperty("显示序号")
|
||||
private int showOrder;
|
||||
|
||||
/**
|
||||
* 车型
|
||||
*/
|
||||
@ApiModelProperty("车型")
|
||||
private Integer carTypeId;
|
||||
|
||||
/**
|
||||
* 是否生效
|
||||
*/
|
||||
@ApiModelProperty("是否生效")
|
||||
private String isActive;
|
||||
}
|
|
@ -2,4 +2,104 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jwl.driver.server.mapper.TdQuestionMapper">
|
||||
|
||||
<select id="queryQuestion" resultType="com.jwl.driver.server.vo.QusetionVo">
|
||||
select
|
||||
tq.QUESTION_ID,
|
||||
tq.QUESTION,
|
||||
tq.CHOOSE_A,
|
||||
tq.CHOOSE_B,
|
||||
tq.CHOOSE_C,
|
||||
tq.CHOOSE_D,
|
||||
tq.CHOOSE_E,
|
||||
tq.CHOOSE_F,
|
||||
tq.CHOOSE_G,
|
||||
tq.TRUE_ANSWER,
|
||||
tq.CIDS,
|
||||
tq.CATEGORY,
|
||||
tq.IMAGE_URL,
|
||||
tq.SOHU_IMG,
|
||||
tq.BEST_ANSWER,
|
||||
tq.CHAPTER,
|
||||
tq.SUBJECT,
|
||||
tq.OPTIONS,
|
||||
tq.TYPE,
|
||||
tq.SHOW_ORDER,
|
||||
tq.CAR_TYPE_ID,
|
||||
tq.IS_ACTIVE
|
||||
from td_question tq
|
||||
left join td_question_point tqp on tq.QUESTION_ID = tqp.QUESTION_ID and tq.CAR_TYPE_ID = tqp.CAR_TYPE_ID and
|
||||
tqp.IS_ACTIVE = '0'
|
||||
<where>
|
||||
tq.IS_ACTIVE = '0'
|
||||
<if test="queryDto.questionId !=null">
|
||||
and tq.QUESTION_ID = #{queryDto.questionId}
|
||||
</if>
|
||||
<if test="queryDto.questionIdList !=null and queryDto.questionIdList.size() > 0">
|
||||
and tq.QUESTION_ID in
|
||||
<foreach collection="queryDto.questionIdList" open="(" item="item" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryDto.chapter !=null and queryDto.chapter !=''">
|
||||
and tq.CHAPTER = #{queryDto.chapter}
|
||||
</if>
|
||||
<if test="queryDto.subject !=null and queryDto.subject !=''">
|
||||
and tq.SUBJECT = #{queryDto.subject}
|
||||
</if>
|
||||
<if test="queryDto.carTypeId !=null">
|
||||
and tq.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||
</if>
|
||||
<if test="queryDto.type !=null">
|
||||
and tq.TYPE = #{queryDto.type}
|
||||
</if>
|
||||
<if test="queryDto.cid !=null and queryDto.cid !=''">
|
||||
and find_in_set(#{queryDto.cid},tq.CIDS)
|
||||
</if>
|
||||
<if test="queryDto.point !=null and queryDto.point !=''">
|
||||
and tqp.POINT = #{queryDto.point}
|
||||
</if>
|
||||
</where>
|
||||
group by tq.QUESTION_ID
|
||||
order by tq.SHOW_ORDER asc
|
||||
</select>
|
||||
|
||||
<select id="queryQuestionByRandom" resultType="com.jwl.driver.server.vo.QusetionVo">
|
||||
select
|
||||
tq.QUESTION_ID,
|
||||
tq.QUESTION,
|
||||
tq.CHOOSE_A,
|
||||
tq.CHOOSE_B,
|
||||
tq.CHOOSE_C,
|
||||
tq.CHOOSE_D,
|
||||
tq.CHOOSE_E,
|
||||
tq.CHOOSE_F,
|
||||
tq.CHOOSE_G,
|
||||
tq.TRUE_ANSWER,
|
||||
tq.CIDS,
|
||||
tq.CATEGORY,
|
||||
tq.IMAGE_URL,
|
||||
tq.SOHU_IMG,
|
||||
tq.BEST_ANSWER,
|
||||
tq.CHAPTER,
|
||||
tq.SUBJECT,
|
||||
tq.OPTIONS,
|
||||
tq.TYPE,
|
||||
tq.SHOW_ORDER,
|
||||
tq.CAR_TYPE_ID,
|
||||
tq.IS_ACTIVE
|
||||
from td_question tq
|
||||
<where>
|
||||
tq.IS_ACTIVE = '0'
|
||||
<if test="queryDto.subject !=null and queryDto.subject !=''">
|
||||
and tq.SUBJECT = #{queryDto.subject}
|
||||
</if>
|
||||
<if test="queryDto.carTypeId !=null">
|
||||
and tq.CAR_TYPE_ID = #{queryDto.carTypeId}
|
||||
</if>
|
||||
<if test="queryDto.type !=null">
|
||||
and tq.TYPE = #{queryDto.type}
|
||||
</if>
|
||||
</where>
|
||||
order by rand() limit ${queryDto.num};
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue