ExamKnowledgeMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. q.*
  38. FROM
  39. exam_knowledge k
  40. LEFT JOIN (
  41. SELECT
  42. b.knowledge_id as k_id,
  43. b.business_id,
  44. b.subject_id,
  45. s.business_name,
  46. j.subject_name,
  47. e.education_name,
  48. e.id AS education_id,
  49. p.project_name,
  50. p.id as project_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. ) q ON q.k_id = k.knowledge_id
  58. <if test="status != null and status.size()!=0 ">
  59. AND k.status in
  60. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  61. #{item}
  62. </foreach>
  63. </if>
  64. <if test="educationId != null and educationId !=0 ">
  65. AND q.education_id = #{educationId}
  66. </if>
  67. <if test="courseSubjectId != null and courseSubjectId !=0 ">
  68. AND q.subject_id = #{courseSubjectId}
  69. </if>
  70. <if test="businessId != null and businessId !=0 ">
  71. AND q.business_id = #{businessId}
  72. </if>
  73. <if test="knowledgeName != null and knowledgeName !=0 ">
  74. AND k.knowledge_name like concat('%', #{knowledgeName}, '%')
  75. </if>
  76. </select>
  77. </mapper>