ExamMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.bank.mapper.ExamMapper">
  6. <resultMap type="com.zhongzheng.modules.bank.domain.Exam" id="ExamResult">
  7. <result property="examId" column="exam_id"/>
  8. <result property="status" column="status"/>
  9. <result property="createTime" column="create_time"/>
  10. <result property="updateTime" column="update_time"/>
  11. <result property="prefixName" column="prefix_name"/>
  12. <result property="code" column="code"/>
  13. <result property="examName" column="exam_name"/>
  14. <result property="publishStatus" column="publish_status"/>
  15. <result property="year" column="year"/>
  16. <result property="cityId" column="city_id"/>
  17. <result property="provinceId" column="province_id"/>
  18. <result property="examPaperId" column="exam_paper_id"/>
  19. <result property="answerTime" column="answer_time"/>
  20. <result property="examPaperId" column="exam_paper_id"/>
  21. <result property="answerNum" column="answer_num"/>
  22. <result property="sort" column="sort"/>
  23. <result property="createBy" column="create_by"/>
  24. <result property="doType" column="do_type"/>
  25. </resultMap>
  26. <resultMap type="com.zhongzheng.modules.bank.vo.ExamVo" id="ExamVoResult">
  27. <result property="examId" column="exam_id"/>
  28. <result property="status" column="status"/>
  29. <result property="createTime" column="create_time"/>
  30. <result property="updateTime" column="update_time"/>
  31. <result property="prefixName" column="prefix_name"/>
  32. <result property="code" column="code"/>
  33. <result property="examName" column="exam_name"/>
  34. <result property="publishStatus" column="publish_status"/>
  35. <result property="year" column="year"/>
  36. <result property="cityId" column="city_id"/>
  37. <result property="provinceId" column="province_id"/>
  38. <result property="examPaperId" column="exam_paper_id"/>
  39. <result property="answerTime" column="answer_time"/>
  40. <result property="examPaperId" column="exam_paper_id"/>
  41. <result property="answerNum" column="answer_num"/>
  42. <result property="sort" column="sort"/>
  43. <result property="educationName" column="education_name"/>
  44. <result property="projectName" column="project_name"/>
  45. <result property="businessName" column="business_name"/>
  46. <result property="educationTypeId" column="education_type_id"/>
  47. <result property="businessId" column="business_id"/>
  48. <result property="subjectId" column="subject_id"/>
  49. <result property="projectId" column="project_id"/>
  50. <result property="subjectName" column="subject_name"/>
  51. <result property="doType" column="do_type"/>
  52. <collection property="goodsList" column="exam_id" select="findGoodsList"/>
  53. </resultMap>
  54. <select id="findGoodsList" resultMap="GoodsListResult">
  55. SELECT
  56. g.goods_name,
  57. g.goods_id
  58. FROM
  59. goods_attached ga
  60. LEFT JOIN goods g ON ga.goods_id = g.goods_id
  61. WHERE
  62. ga.major_id =#{exam_id} AND ga.type = 3
  63. </select>
  64. <resultMap type="com.zhongzheng.modules.bank.vo.ExamGoodsVo" id="GoodsListResult">
  65. <result property="goodsName" column="goods_name"/>
  66. <result property="goodsId" column="goods_id"/>
  67. </resultMap>
  68. <select id="getList" parameterType="com.zhongzheng.modules.bank.bo.ExamQueryBo" resultMap="ExamVoResult">
  69. SELECT
  70. e.*,
  71. qb.education_type_id,
  72. qb.business_id,
  73. qb.project_id,
  74. qb.subject_id,
  75. cet.education_name,
  76. cpt.project_name,
  77. cb.business_name,
  78. cs.subject_name
  79. FROM
  80. exam e
  81. LEFT JOIN question_business qb ON e.exam_id = qb.major_id
  82. AND qb.type = 2
  83. LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
  84. LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id
  85. LEFT JOIN course_business cb ON qb.business_id = cb.id
  86. LEFT JOIN course_subject cs ON cs.id = qb.subject_id where 1=1
  87. <if test="status != null and status.size()!=0 ">
  88. AND e.status in
  89. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  90. #{item}
  91. </foreach>
  92. </if>
  93. <if test="educationTypeId != null and educationTypeId != ''">
  94. AND cet.id = #{educationTypeId}
  95. </if>
  96. <if test="examId != null and examId != ''">
  97. AND e.exam_id = #{examId}
  98. </if>
  99. <if test="subjectId != null and subjectId != ''">
  100. AND cs.id = #{subjectId}
  101. </if>
  102. <if test="businessId != null and businessId != ''">
  103. AND cb.id = #{businessId}
  104. </if>
  105. <if test="projectId != null and projectId != ''">
  106. AND cpt.id = #{projectId}
  107. </if>
  108. <if test="examPaperId != null and examPaperId != ''">
  109. AND e.exam_paper_id = #{examPaperId}
  110. </if>
  111. <if test="publishStatus != null and publishStatus != ''">
  112. AND e.publish_status = #{publishStatus}
  113. </if>
  114. <if test="examName != null and examName != ''">
  115. AND e.exam_name like concat('%', #{examName}, '%')
  116. </if>
  117. <if test="prefixName != null and prefixName != ''">
  118. AND e.prefix_name like concat('%', #{prefixName}, '%')
  119. </if>
  120. <if test="key != null and key != ''">
  121. AND (e.exam_name like concat('%', #{key}, '%') or e.prefix_name like concat('%', #{key}, '%') or e.code = #{key})
  122. </if>
  123. ORDER BY e.exam_id DESC
  124. </select>
  125. </mapper>