LessonCoursewareMapper.xml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.ym.mec.biz.dal.mapper.LessonCoursewareMapper">
  4. <sql id="selectPageSql">
  5. <where>
  6. <if test="param.studentId != null">
  7. AND (lc.student_range_type_ == 'ALL' OR (lcum.user_id_ = #{param.studentId} AND lcum.user_type_ = 'STUDENT'))
  8. </if>
  9. <if test="param.teacherId != null">
  10. AND (lc.teacher_range_type_ == 'ALL' OR (lcum.user_id_ = #{param.teacherId} AND lcum.user_type_ = 'TEACHER'))
  11. </if>
  12. <if test="param.lessonCoursewareIds != null">
  13. and lc.lesson_course_id_ IN
  14. <foreach collection="param.lessonCoursewareIds" item="lessonCoursewareId" open="(" close=")" separator=",">
  15. #{lessonCoursewareId}
  16. </foreach>
  17. </if>
  18. <if test="param.subjectId != null">
  19. and lc.id_subject_id_ = #{param.subjectId}
  20. </if>
  21. <if test="param.studentRangeType != null and param.studentRangeType != ''">
  22. and lc.student_range_type_ = #{param.studentRangeType}
  23. </if>
  24. <if test="param.teacherRangeType != null and param.teacherRangeType != ''">
  25. and lc.teacher_range_type_ = #{param.teacherRangeType}
  26. </if>
  27. <if test="param.enable != null">
  28. and lc.id_enable_ = #{param.enable}
  29. </if>
  30. </where>
  31. </sql>
  32. <select id="selectPage" resultType="com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper$LessonCoursewareDto">
  33. select lc.id_ id, lc.subject_id_ subjectId, lc.lesson_course_id_ lessonCoursewareId, lc.enable_ enable,
  34. lc.student_range_type_ studentRangeType, lc.teacher_range_type_ teacherRangeType
  35. from lesson_courseware lc
  36. left join lesson_courseware_user_mapper lcum ON lcum.lesson_courseware_id_ = lc.id_
  37. <include refid="selectPageSql"/>
  38. GROUP BY lc.id_
  39. order by lc.create_time_ desc
  40. </select>
  41. <select id="selectList" resultType="com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper$LessonCoursewareDto">
  42. select lc.id_ id, lc.subject_id_ subjectId, lc.lesson_course_id_ lessonCoursewareId, lc.enable_ enable from lesson_courseware lc
  43. left join lesson_courseware_user_mapper lcum ON lcum.lesson_courseware_id_ = lc.id_
  44. <include refid="selectPageSql"/>
  45. GROUP BY lc.id_
  46. order by lc.create_time_ desc
  47. </select>
  48. <select id="getLessonCoursewareSubjectList" resultMap="com.ym.mec.biz.dal.dao.SubjectDao.Subject">
  49. select s.* from lesson_courseware lc
  50. left join subject s on s.id_ = lc.subject_id_
  51. where lc.subject_id_ IS NOT NULL
  52. group by lc.subject_id_
  53. </select>
  54. </mapper>