CourseInfoMapper.xml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.education.business.mapper.education.CourseInfoMapper">
  4. <select id="selectPageList" resultType="com.education.model.dto.CourseInfoDto">
  5. SELECT
  6. course.*,
  7. subject.name subject_name,
  8. grade.name gradeInfoName,
  9. collect.student_id
  10. FROM
  11. course_info course
  12. LEFT JOIN subject_info subject ON course.subject_id = subject.id
  13. LEFT JOIN grade_info grade ON course.grade_info_id = grade.id
  14. LEFT JOIN student_course_collect collect ON course.id = collect.course_id
  15. <where>
  16. <if test="courseInfo.name != null and courseInfo.name != ''">
  17. <bind name="name" value="'%' + courseInfo.name + '%'"/>
  18. and course.name like #{name}
  19. </if>
  20. <if test="courseInfo.recommendIndexFlag != null">
  21. and course.recommend_index_flag = #{courseInfo.recommendIndexFlag}
  22. </if>
  23. <if test="courseInfo.gradeInfoId != null">
  24. and course.grade_info_id = #{courseInfo.gradeInfoId}
  25. </if>
  26. <if test="courseInfo.subjectId != null">
  27. and course.subject_id = #{courseInfo.subjectId}
  28. </if>
  29. <if test="courseInfo.status != null">
  30. and course.status = #{courseInfo.status}
  31. </if>
  32. </where>
  33. order by course.sort desc
  34. </select>
  35. </mapper>