12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.ym.mec.biz.dal.mapper.LessonCoursewareMapper">
- <sql id="selectPageSql">
- <where>
- <if test="param.studentId != null">
- AND (lc.student_range_type_ == 'ALL' OR (lcum.user_id_ = #{param.studentId} AND lcum.user_type_ = 'STUDENT'))
- </if>
- <if test="param.teacherId != null">
- AND (lc.teacher_range_type_ == 'ALL' OR (lcum.user_id_ = #{param.teacherId} AND lcum.user_type_ = 'TEACHER'))
- </if>
- <if test="param.lessonCoursewareIds != null">
- and lc.lesson_course_id_ IN
- <foreach collection="param.lessonCoursewareIds" item="lessonCoursewareId" open="(" close=")" separator=",">
- #{lessonCoursewareId}
- </foreach>
- </if>
- <if test="param.subjectId != null">
- and lc.id_subject_id_ = #{param.subjectId}
- </if>
- <if test="param.studentRangeType != null and param.studentRangeType != ''">
- and lc.student_range_type_ = #{param.studentRangeType}
- </if>
- <if test="param.teacherRangeType != null and param.teacherRangeType != ''">
- and lc.teacher_range_type_ = #{param.teacherRangeType}
- </if>
- <if test="param.enable != null">
- and lc.id_enable_ = #{param.enable}
- </if>
- </where>
- </sql>
- <select id="selectPage" resultType="com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper$LessonCoursewareDto">
- select lc.id_ id, lc.subject_id_ subjectId, lc.lesson_course_id_ lessonCoursewareId, lc.enable_ enable,
- lc.student_range_type_ studentRangeType, lc.teacher_range_type_ teacherRangeType
- from lesson_courseware lc
- left join lesson_courseware_user_mapper lcum ON lcum.lesson_courseware_id_ = lc.id_
- <include refid="selectPageSql"/>
- GROUP BY lc.id_
- order by lc.create_time_ desc
- </select>
- <select id="selectList" resultType="com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper$LessonCoursewareDto">
- select lc.id_ id, lc.subject_id_ subjectId, lc.lesson_course_id_ lessonCoursewareId, lc.enable_ enable from lesson_courseware lc
- left join lesson_courseware_user_mapper lcum ON lcum.lesson_courseware_id_ = lc.id_
- <include refid="selectPageSql"/>
- GROUP BY lc.id_
- order by lc.create_time_ desc
- </select>
- <select id="getLessonCoursewareSubjectList" resultMap="com.ym.mec.biz.dal.dao.SubjectDao.Subject">
- select s.* from lesson_courseware lc
- left join subject s on s.id_ = lc.subject_id_
- where lc.subject_id_ IS NOT NULL
- group by lc.subject_id_
- </select>
- </mapper>
|