ExamKnowledgeMapper.xml 4.9 KB

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