QuestionWrongMapper.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.miaxis.question.mapper.QuestionWrongMapper">
  6. <resultMap type="QuestionWrong" id="QuestionWrongResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="questionId" column="question_id" />
  10. <result property="createTime" column="create_time" />
  11. <result property="updateTime" column="update_time" />
  12. </resultMap>
  13. <sql id="selectQuestionWrongVo">
  14. select * from question_wrong
  15. </sql>
  16. <select id="selectQuestionWrongList" parameterType="QuestionWrong" resultMap="QuestionWrongResult">
  17. <include refid="selectQuestionWrongVo"/>
  18. <where>
  19. <if test="userId != null and userId !='' "> and user_id = #{userId}</if>
  20. <if test="km != null and km!='' "> and km = #{km}</if>
  21. </where>
  22. </select>
  23. <select id="selectWrongIdByUserId" resultType="com.miaxis.question.vo.QuestionWrongIdDateVo">
  24. select q1.id,q2.create_time from question_info q1 join question_wrong q2 on q1.id = q2.question_id
  25. <where>
  26. <if test="userId != null and userId !='' "> and q2.user_id = #{userId}</if>
  27. <if test="km != null and km!='' "> and q2.km = #{km}</if>
  28. </where>
  29. order by q2.create_time
  30. </select>
  31. <select id="selectWrongCountByUserId" resultType="int">
  32. select count(1) from question_info q1 join question_wrong q2 on q1.id = q2.question_id
  33. <where>
  34. <if test="userId != null and userId !='' "> and q2.user_id = #{userId}</if>
  35. <if test="km != null and km!='' "> and q2.km = #{km}</if>
  36. </where>
  37. </select>
  38. </mapper>