无人机小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wrj-applet-api/src/main/resources/mapper/WrjQuestionPracticeMapper.xml

93 lines
3.6 KiB

<?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.wrj.driver.server.mapper.WrjQuestionPracticeMapper">
5 days ago
<update id="clearPracticeRecord">
update
wrj_question_practice
set is_clear = 1
where user_id = #{userId} and practice_type = #{practiceType} and is_clear = 0
5 days ago
</update>
<select id="queryQuestionPracticePage" resultType="com.wrj.driver.server.vo.QuestionPracticeVo">
select
wqp.practice_id,
wqp.question_id,
wqp.user_id,
wqp.practice_type,
wqp.answer,
wqp.answer_result,
DATE_FORMAT(wqp.practice_time, '%Y-%m-%d %H:%i:%s') as practiceTime,
su.user_name,
su.phone,
wq.question,
wq.image_url,
wq.choose_a,
wq.choose_b,
wq.choose_c,
wq.choose_d,
wq.choose_e,
wq.choose_f,
wq.type,
wq.true_answer
from wrj_question_practice wqp
left join wrj_question wq on wqp.question_id = wq.question_id
left join sys_user su on su.user_id = wqp.user_id
<where>
<if test="queryDto.questionId !=null">
and wqp.question_id = #{queryDto.questionId}
</if>
<if test="queryDto.practiceType !=null and queryDto.practiceType !=''">
and wqp.practice_type = #{queryDto.practiceType}
</if>
<if test="queryDto.practiceTypeList !=null and queryDto.practiceTypeList.size() > 0 ">
and wqp.practice_type in
<foreach collection="queryDto.practiceTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="queryDto.question !=null and queryDto.question !=''">
and wq.question like concat('%' , #{queryDto.question} , '%')
</if>
<if test="queryDto.userNameOrPhone !=null and queryDto.userNameOrPhone !=''">
and (su.user_name like concat('%' , #{queryDto.userNameOrPhone} , '%')
or su.phone like concat('%' , #{queryDto.userNameOrPhone})
</if>
<if test="queryDto.answerResult !=null and queryDto.answerResult !=''">
and wqp.answer_result = #{queryDto.answerResult}
</if>
</where>
group by wqp.practice_id desc
</select>
<select id="queryUserQuestionPracticeMsg" resultType="com.wrj.driver.server.vo.UserQuestionPracticeVo">
select
wqp.question_id,
wqp.user_id,
wqp.answer,
wqp.answer_result,
DATE_FORMAT(wqp.practice_time, '%Y-%m-%d %H:%i:%s') as practiceTime,
wqpt.answer_number as userAnswerNumbr,
wqpt.right_number as userRightNumber
from
wrj_question_practice wqp
left join wrj_question_practice_total wqpt on wqp.question_id = wqpt.question_id and wqp.user_id = wqpt.user_id
<where>
wqp.is_clear = 0
<if test="questionIdList !=null and questionIdList.size() > 0">
and wqp.question_id in
<foreach collection="questionIdList" open="(" item="item" separator="," close=")">
#{item}
</foreach>
</if>
<if test="userId !=null">
and wqp.user_id = #{userId}
</if>
<if test="practiceType !=null and practiceType !=''">
and wqp.practice_type = #{practiceType}
</if>
</where>
</select>
</mapper>