| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?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.zhongzheng.modules.top.goods.mapper.TopQuestionMapper">
- <select id="getBankGoodsExamList" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.top.goods.vo.TopBankGoodsExamVo">
- SELECT
- ga.goods_id AS goodsId,
- qmc.module_exam_id AS moduleExamId,
- qce.chapter_exam_id AS chapterExamId,
- e.exam_id AS examId,
- e.exam_name AS examName,
- ep.paper_name AS paperName
- FROM
- top_goods_attached ga
- LEFT JOIN top_question_module_chapter qmc ON ga.major_id = qmc.module_exam_id
- LEFT JOIN top_question_chapter_exam qce ON qmc.chapter_exam_id = qce.chapter_exam_id
- LEFT JOIN top_exam e ON qce.exam_id = e.exam_id
- LEFT JOIN top_exam_paper ep ON e.exam_paper_id = ep.paper_id
- WHERE
- ga.goods_id = #{goodsId} AND ga.type = 1
- UNION ALL
- SELECT
- ga.goods_id AS goodsId,
- 0 AS moduleExamId,
- qce.chapter_exam_id AS chapterExamId,
- e.exam_id AS examId,
- e.exam_name AS examName,
- ep.paper_name AS paperName
- FROM
- top_goods_attached ga
- LEFT JOIN top_question_chapter_exam qce ON ga.major_id = qce.chapter_exam_id
- LEFT JOIN top_exam e ON qce.exam_id = e.exam_id
- LEFT JOIN top_exam_paper ep ON e.exam_paper_id = ep.paper_id
- WHERE
- ga.goods_id = #{goodsId} AND ga.type = 2
- UNION ALL
- SELECT
- ga.goods_id AS goodsId,
- 0 AS moduleExamId,
- 0 AS chapterExamId,
- e.exam_id AS examId,
- e.exam_name AS examName,
- ep.paper_name AS paperName
- FROM
- top_goods_attached ga
- LEFT JOIN top_exam e ON ga.major_id = e.exam_id
- LEFT JOIN top_exam_paper ep ON e.exam_paper_id = ep.paper_id
- WHERE
- ga.goods_id = #{goodsId} AND ga.type = 3
- </select>
- </mapper>
|