ExamKnowledgeMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.exam.mapper.ExamKnowledgeMapper">
  6. <resultMap type="com.zhongzheng.modules.exam.domain.ExamKnowledge" id="ExamKnowledgeResult">
  7. <result property="knowledgeId" column="knowledge_id"/>
  8. <result property="knowledgeName" column="knowledge_name"/>
  9. <result property="status" column="status"/>
  10. <result property="createTime" column="create_time"/>
  11. <result property="updateTime" column="update_time"/>
  12. <result property="encoder" column="encoder"/>
  13. </resultMap>
  14. <resultMap type="com.zhongzheng.modules.exam.vo.ExamKnowledgeVo" id="ExamKnowledgeVoResult">
  15. <result property="knowledgeId" column="knowledge_id"/>
  16. <result property="knowledgeName" column="knowledge_name"/>
  17. <result property="status" column="status"/>
  18. <result property="encoder" column="encoder"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. <association property="courseBusinessList" javaType="java.util.List" resultMap="CourseBusinessVoResult" />
  22. </resultMap>
  23. <resultMap type="com.zhongzheng.modules.course.vo.CourseBusinessVo" id="CourseBusinessVoResult">
  24. <result property="businessName" column="business_name"/>
  25. <result property="businessId" column="business_id"/>
  26. <result property="subjectId" column="subject_id"/>
  27. <result property="remark" column="remark"/>
  28. <result property="projectId" column="project_id"/>
  29. <result property="schoolYear" column="school_year"/>
  30. <result property="status" column="status"/>
  31. <result property="educationName" column="education_name"/>
  32. <result property="projectName" column="project_name"/>
  33. <result property="educationId" column="education_id"/>
  34. <result property="subjectName" column="subject_name"/>
  35. </resultMap>
  36. <select id="queryList" parameterType="com.zhongzheng.modules.exam.bo.ExamKnowledgeQueryBo" resultMap="ExamKnowledgeVoResult">
  37. SELECT
  38. k.*
  39. FROM
  40. exam_knowledge k where 1=1
  41. <if test="status != null and status.size()!=0 ">
  42. AND k.status in
  43. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  44. #{item}
  45. </foreach>
  46. </if>
  47. <if test="educationId != null and educationId !=0 ">
  48. AND #{educationId} in (
  49. SELECT
  50. e.id AS education_id
  51. FROM
  52. exam_knowledge_business b
  53. LEFT JOIN course_business s ON s.id = b.business_id
  54. LEFT JOIN course_subject j ON j.id = b.subject_id
  55. LEFT JOIN course_project_type p ON s.project_id = p.id
  56. LEFT JOIN course_education_type e ON p.education_id = e.id
  57. WHERE
  58. b.knowledge_id = k.knowledge_id
  59. )
  60. </if>
  61. <if test="subjectId != null and subjectId !=0 ">
  62. AND #{subjectId} in (
  63. SELECT
  64. b.subject_id
  65. FROM
  66. exam_knowledge_business b
  67. LEFT JOIN course_business s ON s.id = b.business_id
  68. LEFT JOIN course_subject j ON j.id = b.subject_id
  69. LEFT JOIN course_project_type p ON s.project_id = p.id
  70. LEFT JOIN course_education_type e ON p.education_id = e.id
  71. WHERE
  72. b.knowledge_id = k.knowledge_id
  73. )
  74. </if>
  75. <if test="businessId != null and businessId !=0 ">
  76. AND #{businessId} in (
  77. SELECT
  78. b.business_id
  79. FROM
  80. exam_knowledge_business b
  81. LEFT JOIN course_business s ON s.id = b.business_id
  82. LEFT JOIN course_subject j ON j.id = b.subject_id
  83. LEFT JOIN course_project_type p ON s.project_id = p.id
  84. LEFT JOIN course_education_type e ON p.education_id = e.id
  85. WHERE
  86. b.knowledge_id = k.knowledge_id
  87. )
  88. </if>
  89. <if test="knowledgeName != null ">
  90. AND k.knowledge_name like concat('%', #{knowledgeName}, '%')
  91. </if>
  92. order by k.create_time desc
  93. </select>
  94. <select id="queryCourseBusinessList" resultType="long" resultMap="CourseBusinessVoResult">
  95. SELECT
  96. b.knowledge_id as k_id,
  97. b.business_id,
  98. b.subject_id,
  99. s.business_name,
  100. j.subject_name,
  101. e.education_name,
  102. e.id AS education_id,
  103. p.project_name,
  104. p.id as project_id
  105. FROM
  106. exam_knowledge_business b
  107. LEFT JOIN course_business s ON s.id = b.business_id
  108. LEFT JOIN course_subject j ON j.id = b.subject_id
  109. LEFT JOIN course_project_type p ON s.project_id = p.id
  110. LEFT JOIN course_education_type e ON p.education_id = e.id
  111. WHERE b.knowledge_id = #{knowledgeId}
  112. and s.status=1
  113. </select>
  114. </mapper>