2023-08-11 11:51:09 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!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">
|
|
|
|
|
2023-08-14 01:31:26 +08:00
|
|
|
<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,
|
2023-08-19 00:39:11 +08:00
|
|
|
tq.IS_ACTIVE,
|
|
|
|
tq.IS_VIP,
|
|
|
|
tq.IS_ERROR,
|
|
|
|
tq.IS_NEW,
|
2023-08-19 13:49:56 +08:00
|
|
|
tq.EXAM_KEYS,
|
|
|
|
tq.IS_EXAM1,
|
|
|
|
tq.IS_EXAM2,
|
|
|
|
tq.IS_VIP2
|
2023-08-14 01:31:26 +08:00
|
|
|
from td_question tq
|
2023-08-15 01:37:50 +08:00
|
|
|
left join td_point_question tpq on tq.QUESTION_ID = tpq.QUESTION_ID and tq.CAR_TYPE_ID = tpq.CAR_TYPE_ID and
|
|
|
|
tpq.IS_ACTIVE = '0'
|
2023-08-14 01:31:26 +08:00
|
|
|
<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>
|
2023-08-19 00:39:11 +08:00
|
|
|
<if test="queryDto.question !=null and queryDto.question !=''">
|
|
|
|
and tq.QUESTION like concat('%' , #{queryDto.question} , '%')
|
|
|
|
</if>
|
2023-08-14 01:31:26 +08:00
|
|
|
<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>
|
2023-08-15 01:37:50 +08:00
|
|
|
<if test="queryDto.type !=null and queryDto.type != ''">
|
2023-08-14 01:31:26 +08:00
|
|
|
and tq.TYPE = #{queryDto.type}
|
|
|
|
</if>
|
|
|
|
<if test="queryDto.cid !=null and queryDto.cid !=''">
|
|
|
|
and find_in_set(#{queryDto.cid},tq.CIDS)
|
|
|
|
</if>
|
2023-08-16 23:46:01 +08:00
|
|
|
<if test="queryDto.category !=null and queryDto.category !=''">
|
|
|
|
and find_in_set(#{queryDto.category},tq.CATEGORY)
|
|
|
|
</if>
|
2023-08-14 01:31:26 +08:00
|
|
|
<if test="queryDto.point !=null and queryDto.point !=''">
|
2023-08-15 01:37:50 +08:00
|
|
|
and tpq.POINT = #{queryDto.point}
|
2023-08-14 01:31:26 +08:00
|
|
|
</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,
|
2023-08-19 00:39:11 +08:00
|
|
|
tq.IS_ACTIVE,
|
|
|
|
tq.IS_VIP,
|
|
|
|
tq.IS_ERROR,
|
|
|
|
tq.IS_NEW,
|
2023-08-19 13:49:56 +08:00
|
|
|
tq.EXAM_KEYS,
|
|
|
|
tq.IS_EXAM1,
|
|
|
|
tq.IS_EXAM2,
|
|
|
|
tq.IS_VIP2
|
2023-08-14 01:31:26 +08:00
|
|
|
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>
|
2023-08-19 00:39:11 +08:00
|
|
|
|
|
|
|
<update id="updateQuestion" parameterType="com.jwl.driver.server.vo.QusetionVo">
|
|
|
|
update td_question
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="qusetionVo.isVip !=null">
|
|
|
|
IS_VIP = #{qusetionVo.isVip},
|
|
|
|
</if>
|
|
|
|
<if test="qusetionVo.isError !=null">
|
|
|
|
IS_ERROR = #{qusetionVo.isError},
|
|
|
|
</if>
|
|
|
|
<if test="qusetionVo.isNew !=null">
|
|
|
|
IS_NEW = #{qusetionVo.isNew},
|
|
|
|
</if>
|
|
|
|
<if test="qusetionVo.examKeys !=null">
|
|
|
|
EXAM_KEYS = #{qusetionVo.examKeys},
|
|
|
|
</if>
|
2023-08-19 13:49:56 +08:00
|
|
|
<if test="qusetionVo.isVip2 !=null">
|
|
|
|
IS_VIP2 = #{qusetionVo.isVip2},
|
|
|
|
</if>
|
|
|
|
<if test="qusetionVo.isExam1 !=null">
|
|
|
|
IS_EXAM1 = #{qusetionVo.isExam1},
|
|
|
|
</if>
|
|
|
|
<if test="qusetionVo.isExam2 !=null">
|
|
|
|
IS_EXAM2 = #{qusetionVo.isExam2},
|
|
|
|
</if>
|
2023-08-19 00:39:11 +08:00
|
|
|
</trim>
|
|
|
|
where QUESTION_ID = #{qusetionVo.questionId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
2023-08-11 11:51:09 +08:00
|
|
|
</mapper>
|