TopQuestionMapper.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.zhongzheng.modules.top.goods.mapper.TopQuestionMapper">
  6. <select id="getBankGoodsExamList" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.top.goods.vo.TopBankGoodsExamVo">
  7. SELECT
  8. ga.goods_id AS goodsId,
  9. qmc.module_exam_id AS moduleExamId,
  10. qce.chapter_exam_id AS chapterExamId,
  11. e.exam_id AS examId,
  12. e.exam_name AS examName,
  13. ep.paper_name AS paperName
  14. FROM
  15. top_goods_attached ga
  16. LEFT JOIN top_question_module_chapter qmc ON ga.major_id = qmc.module_exam_id
  17. LEFT JOIN top_question_chapter_exam qce ON qmc.chapter_exam_id = qce.chapter_exam_id
  18. LEFT JOIN top_exam e ON qce.exam_id = e.exam_id
  19. LEFT JOIN top_exam_paper ep ON e.exam_paper_id = ep.paper_id
  20. WHERE
  21. ga.goods_id = #{goodsId} AND ga.type = 1
  22. UNION ALL
  23. SELECT
  24. ga.goods_id AS goodsId,
  25. 0 AS moduleExamId,
  26. qce.chapter_exam_id AS chapterExamId,
  27. e.exam_id AS examId,
  28. e.exam_name AS examName,
  29. ep.paper_name AS paperName
  30. FROM
  31. top_goods_attached ga
  32. LEFT JOIN top_question_chapter_exam qce ON ga.major_id = qce.chapter_exam_id
  33. LEFT JOIN top_exam e ON qce.exam_id = e.exam_id
  34. LEFT JOIN top_exam_paper ep ON e.exam_paper_id = ep.paper_id
  35. WHERE
  36. ga.goods_id = #{goodsId} AND ga.type = 2
  37. UNION ALL
  38. SELECT
  39. ga.goods_id AS goodsId,
  40. 0 AS moduleExamId,
  41. 0 AS chapterExamId,
  42. e.exam_id AS examId,
  43. e.exam_name AS examName,
  44. ep.paper_name AS paperName
  45. FROM
  46. top_goods_attached ga
  47. LEFT JOIN top_exam e ON ga.major_id = e.exam_id
  48. LEFT JOIN top_exam_paper ep ON e.exam_paper_id = ep.paper_id
  49. WHERE
  50. ga.goods_id = #{goodsId} AND ga.type = 3
  51. </select>
  52. </mapper>