123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616 |
- <?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.dao.ExtracurricularExercisesReplyDao">
-
- <resultMap type="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" id="ExtracurricularExercisesReply">
- <result column="id_" property="id" />
- <result column="extracurricular_exercises_id_" property="extracurricularExercisesId" />
- <result column="title_" property="extracurricularExercises.title" />
- <result column="user_id_" property="userId" />
- <result column="username_" property="user.username" />
- <result column="attachments_" property="attachments" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="remark_" property="remark" />
- <result column="status_" property="status" />
- <result column="is_replied_" property="isReplied" />
- <result column="is_replied_timely_" property="isRepliedTimely" />
- <result column="is_view_" property="isView" />
- <result column="organ_name_" property="organName" />
- <result column="submit_time_" property="submitTime" />
- <result column="music_score_id_" property="musicScoreId" />
- <association property="extracurricularExercises" columnPrefix="ee_" resultMap="com.ym.mec.biz.dal.dao.ExtracurricularExercisesDao.ExtracurricularExercises"/>
- </resultMap>
- <resultMap id="ExtraExerciseStudentsDto" type="com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto" extends="ExtracurricularExercisesReply">
- <result column="student_name_" property="studentName"/>
- <result column="teacher_id_" property="teacherId"/>
- <result column="teacher_name_" property="teacherName"/>
- <result column="avatar_" property="headUrl"/>
- <result column="phone_" property="phone"/>
- <result column="title_" property="title"/>
- <result column="content_" property="content"/>
- <result column="expire_date_" property="expireDate"/>
- <result column="music_score_id_" property="musicScoreId" />
- </resultMap>
- <sql id="queryPageCondition">
- <where>
- <if test="extracurricularExercisesId != null">
- AND extracurricular_exercises_id_ = #{extracurricularExercisesId}
- </if>
- <if test="teacherId != null">
- AND teacher_id_ = #{teacherId}
- </if>
- <if test="organIdList != null">
- AND FIND_IN_SET(o.id_, #{organIdList})
- </if>
- <if test="studentId != null">
- AND user_id_ = #{studentId}
- </if>
- <if test="title != null">
- AND title_ like '%' #{title} '%'
- </if>
- <if test="status != null">
- AND eer.status_ = #{status}
- </if>
- <if test="isReplied != null">
- AND is_replied_ = #{isReplied}
- </if>
- <if test="isView != null">
- AND is_view_ = #{isView}
- </if>
- <if test="search != null">
- AND (title_ like concat('%',#{search},'%') or u.username_ like concat('%',#{search},'%'))
- </if>
- <if test="submitStartTime != null">
- AND date(eer.create_time_) >= #{submitStartTime}
- </if>
- <if test="submitEndTime != null">
- AND date(eer.create_time_) <= #{submitEndTime}
- </if>
- </where>
- </sql>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ExtracurricularExercisesReply" >
- SELECT * FROM extracurricular_exercises_reply WHERE id_ = #{id}
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="ExtracurricularExercisesReply">
- SELECT * FROM extracurricular_exercises_reply ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_,music_score_id_)
- VALUES(#{extracurricularExercisesId},#{userId},#{attachments},NOW(),NOW(),#{remark},#{status},#{isReplied},#{isView},#{isRepliedTimely},#{musicScoreId})
- </insert>
- <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_,music_score_id_)
- VALUES
- <foreach collection="replies" item="reply" separator=",">
- (#{reply.extracurricularExercisesId},#{reply.userId},#{reply.attachments},NOW(),NOW(),#{reply.remark},#{reply.status},#{reply.isReplied},#{reply.isView},#{reply.isRepliedTimely},#{reply.musicScoreId})
- </foreach>
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply">
- UPDATE extracurricular_exercises_reply
- <set>
- <if test="musicScoreId != null">
- music_score_id_ = #{musicScoreId},
- </if>
- <if test="status != null">
- status_ = #{status},
- </if>
- <if test="isView != null">
- is_view_ = #{isView},
- </if>
- <if test="userId != null">
- user_id_ = #{userId},
- </if>
- <if test="remark != null">
- remark_ = #{remark},
- </if>
- <if test="id != null">
- id_ = #{id},
- </if>
- <if test="isReplied != null">
- is_replied_ = #{isReplied},
- </if>
- <if test="isRepliedTimely != null">
- is_replied_timely_ = #{isRepliedTimely},
- </if>
- <if test="extracurricularExercisesId != null">
- extracurricular_exercises_id_ = #{extracurricularExercisesId},
- </if>
- <if test="attachments != null">
- attachments_ = #{attachments},
- </if>
- <if test="submitTime != null">
- submit_time_ = #{submitTime},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{id}
- </update>
-
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM extracurricular_exercises_reply WHERE id_ = #{id}
- </delete>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="ExtraExerciseStudentsDto" parameterType="map">
- SELECT eer.*,u.username_,ee.title_,o.name_ organ_name_,ee.teacher_id_,ee.expire_date_
- FROM extracurricular_exercises_reply eer
- left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
- left join sys_user u on eer.user_id_ = u.id_
- left join teacher t on t.id_ = ee.teacher_id_
- left join organization o on o.id_ = t.organ_id_
- <include refid="queryPageCondition"/>
- ORDER BY eer.id_ <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(eer.id_) FROM extracurricular_exercises_reply eer
- left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
- left join sys_user u on eer.user_id_ = u.id_
- left join teacher t on t.id_ = ee.teacher_id_
- left join organization o on o.id_ = t.organ_id_
- <include refid="queryPageCondition"/>
- </select>
-
- <select id="findExtraExerciseStudents" resultMap="ExtraExerciseStudentsDto">
- SELECT
- eer.*,
- su.username_ student_name_,
- su.avatar_,
- su.phone_
- FROM
- extracurricular_exercises_reply eer
- LEFT JOIN sys_user su ON su.id_ = eer.user_id_
- WHERE eer.extracurricular_exercises_id_= #{extraExerciseId}
- <if test="studentName != null">
- AND su.username_ LIKE CONCAT('%',#{studentName},'%')
- </if>
- </select>
- <select id="findExtraExerciseStudentsByExtraExercises" resultMap="ExtracurricularExercisesReply">
- SELECT * FROM extracurricular_exercises_reply WHERE extracurricular_exercises_id_ IN
- <foreach collection="extraExerciseIds" item="extraExerciseId" open="(" close=")" separator=",">
- #{extraExerciseId}
- </foreach>
- </select>
- <select id="findExtraExerciseReply" resultMap="ExtraExerciseStudentsDto">
- SELECT
- eer.*,
- ee.title_,
- ee.content_,
- ee.expire_date_,
- ee.teacher_id_,
- ee.music_score_id_,
- su.username_ student_name_
- FROM
- extracurricular_exercises_reply eer
- LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
- LEFT JOIN sys_user su ON su.id_ = eer.user_id_
- WHERE
- eer.id_ = #{extraExerciseReplyId}
- </select>
- <sql id="queryStudentExtraExercisesCondition">
- <where>
- <if test="studentId!=null">
- AND eer.user_id_=#{studentId}
- </if>
- <if test="createTime!=null">
- AND DATE_FORMAT(eer.create_time_, '%Y-%m') = DATE_FORMAT(#{createTime}, '%Y-%m')
- </if>
- </where>
- </sql>
- <select id="countStudentExtraExercises" resultType="int">
- SELECT COUNT(id_) FROM extracurricular_exercises_reply eer
- <include refid="queryStudentExtraExercisesCondition"/>
- </select>
- <select id="findStudentExtraExercises" resultMap="ExtraExerciseStudentsDto">
- SELECT
- eer.*,
- ee.title_,
- ee.expire_date_,
- ee.teacher_id_,
- tea.real_name_ teacher_name_,
- tea.avatar_,
- su.username_ student_name_
- FROM
- extracurricular_exercises_reply eer
- LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
- LEFT JOIN sys_user su ON su.id_ = eer.user_id_
- LEFT JOIN sys_user tea ON tea.id_ = ee.teacher_id_
- <include refid="queryStudentExtraExercisesCondition"/>
- ORDER BY eer.create_time_ DESC
- <include refid="global.limit"/>
- </select>
- <select id="countIsSubmitStudents" resultType="int">
- SELECT COUNT(id_) FROM extracurricular_exercises_reply WHERE extracurricular_exercises_id_=#{extraExerciseId} AND attachments_ IS NOT NULL
- </select>
- <sql id="queryExtraExercisesCondition">
- <where>
- <if test="extracurricularExercisesId != null">
- AND extracurricular_exercises_id_ = #{extracurricularExercisesId}
- </if>
- <if test="teacherId != null">
- AND teacher_id_ = #{teacherId}
- </if>
- <if test="organIdList != null">
- AND FIND_IN_SET(o.id_, #{organIdList})
- </if>
- <if test="studentId != null">
- AND user_id_ = #{studentId}
- </if>
- <if test="title != null">
- AND title_ like '%' #{title} '%'
- </if>
- <if test="status != null">
- AND eer.status_ = #{status}
- </if>
- <if test="isReplied != null">
- AND is_replied_ = #{isReplied}
- </if>
- <if test="isView != null">
- AND is_view_ = #{isView}
- </if>
- <if test="search != null">
- AND (title_ like concat('%',#{search},'%') or u.id_=#{search} or u.username_ like concat('%',#{search},'%'))
- </if>
- <if test="submitStartTime != null">
- AND date(eer.create_time_) >= #{submitStartTime}
- </if>
- <if test="submitEndTime != null">
- AND date(eer.create_time_) <= #{submitEndTime}
- </if>
- <if test="expireStartDate != null and expireEndDate != null">
- AND DATE_FORMAT(ee.expire_date_,"%Y%m%d") BETWEEN DATE_FORMAT(#{expireStartDate},"%Y%m%d") AND DATE_FORMAT(#{expireEndDate},"%Y%m%d")
- </if>
- <if test="isRepliedTimely!=null">
- AND eer.is_replied_timely_=#{isRepliedTimely}
- </if>
- <if test="existVipCourse!=null and existVipCourse==1">
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=eer.user_id_ AND cssp.group_type_='VIP' AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW())
- </if>
- <if test="existVipCourse!=null and existVipCourse==0">
- AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=eer.user_id_ AND cssp.group_type_='VIP' AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW())
- </if>
- </where>
- </sql>
- <select id="findExtraExercises" resultMap="ExtraExerciseStudentsDto">
- SELECT eer.*,u.username_,ee.title_,ee.content_,o.name_ organ_name_,ee.teacher_id_,ee.expire_date_
- FROM extracurricular_exercises_reply eer
- left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
- left join sys_user u on eer.user_id_ = u.id_
- left join teacher t on t.id_ = ee.teacher_id_
- left join organization o on o.id_ = u.organ_id_
- <include refid="queryExtraExercisesCondition"/>
- ORDER BY eer.id_ <include refid="global.limit"/>
- </select>
- <select id="countExtraExercises" resultType="int">
- SELECT COUNT(eer.id_) FROM extracurricular_exercises_reply eer
- left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
- left join sys_user u on eer.user_id_ = u.id_
- left join teacher t on t.id_ = ee.teacher_id_
- left join organization o on o.id_ = u.organ_id_
- <include refid="queryExtraExercisesCondition"/>
- </select>
- <select id="findNoPracticeStudentExercisesInWeek" resultMap="ExtracurricularExercisesReply">
- SELECT
- eer.id_,
- eer.user_id_,
- eer.status_,
- eer.submit_time_,
- eer.is_replied_,
- eer.is_replied_timely_
- FROM
- extracurricular_exercises_reply eer
- WHERE
- DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday}
- AND EXISTS (
- SELECT
- cssp.user_id_
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- LEFT JOIN student s ON cssp.user_id_ = s.user_id_
- WHERE
- cssp.group_type_ = 'PRACTICE'
- AND cssp.user_id_=eer.user_id_
- AND s.service_tag_ = 1
- AND cssp.user_id_ NOT IN (
- SELECT
- cssp1.user_id_
- FROM
- course_schedule_student_payment cssp1
- LEFT JOIN course_schedule cs1 ON cssp1.course_schedule_id_ = cs1.id_
- WHERE
- cssp1.group_type_ = 'PRACTICE'
- AND cs1.class_date_ BETWEEN #{monday} AND #{sunday}
- )
- )
- </select>
- <resultMap id="StudentServiceHomeworkDto" type="com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto">
- <result column="id_" property="id" />
- <result column="user_id_" property="userId" />
- <result column="status_" property="status" />
- <result column="is_replied_" property="isReplied" />
- <result column="is_replied_timely_" property="isRepliedTimely" />
- <result column="is_view_" property="isView" />
- <result column="submit_time_" property="submitTime" />
- <result column="type_" property="type" />
- </resultMap>
- <select id="findStudentHomewarksInWeek" resultMap="StudentServiceHomeworkDto">
- SELECT
- eer.id_,
- eer.user_id_,
- eer.status_,
- eer.submit_time_,
- eer.is_replied_,
- eer.is_replied_timely_,
- 'EXTRA' type_
- FROM
- extracurricular_exercises_reply eer
- WHERE
- DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday}
- UNION ALL
- SELECT
- sch.id_,
- sch.user_id_,
- sch.status_,
- sch.submit_time_,
- sch.is_replied_,
- sch.is_replied_timely_,
- 'HOMEWORK' type_
- FROM
- student_course_homework sch
- LEFT JOIN course_schedule cs ON cs.id_ = sch.course_schedule_id_
- WHERE
- cs.group_type_='PRACTICE' AND DATE_FORMAT( sch.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday}
- </select>
- <resultMap id="StudentServiceDetailDto" type="com.ym.mec.biz.dal.dto.StudentServiceDetailDto">
- <result property="homeworkId" column="homework_id_"/>
- <result property="studentHomeworkId" column="student_homework_id_"/>
- <result property="homeworkType" column="homework_type_"/>
- <result property="title" column="title_"/>
- <result property="content" column="content_"/>
- <result property="courseScheduleId" column="course_schedule_id_"/>
- <result property="groupId" column="group_id_"/>
- <result property="groupType" column="group_type_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result property="groupName" column="group_name_"/>
- <result property="courseStartTime" column="course_start_time_"/>
- <result property="courseEndTime" column="course_end_time_"/>
- <result property="teacherId" column="teacher_id_"/>
- <result property="teacherName" column="teacher_name_"/>
- <result property="homeworkCreateTime" column="homework_create_time_"/>
- <result property="submitTime" column="submit_time_"/>
- <result property="isSubmit" column="is_submit_"/>
- <result property="isReplied" column="is_replied_"/>
- <result property="attachments" column="attachments_"/>
- <result property="musicScoreId" column="music_score_id_"/>
- </resultMap>
- <select id="findStudentHomeworkDetailsInTimeZone" resultMap="StudentServiceDetailDto">
- (SELECT
- ee.id_ homework_id_,
- eer.id_ student_homework_id_,
- eer.music_score_id_,
- ee.title_,
- NULL course_schedule_id_,
- ee.teacher_id_,
- tea.real_name_ teacher_name_,
- NULL group_id_,
- NULL group_type_,
- NULL group_name_,
- ee.create_time_ course_start_time_,
- NULL course_end_time_,
- ee.content_,
- ee.create_time_ homework_create_time_,
- eer.user_id_,
- eer.attachments_,
- eer.submit_time_,
- eer.is_replied_,
- 'EXTRA' homework_type_
- FROM
- extracurricular_exercises_reply eer
- LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
- LEFT JOIN sys_user tea ON ee.teacher_id_=tea.id_
- WHERE
- eer.user_id_=#{studentId} AND DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday})
- UNION ALL
- (SELECT
- ch.id_ homework_id_,
- sch.id_ student_homework_id_,
- sch.music_score_id_,
- NULL title_,
- cs.id_ course_schedule_id_,
- cs.actual_teacher_id_,
- tea.real_name_ teacher_name_,
- cs.music_group_id_ group_id_,
- cs.group_type_,
- cs.name_ group_name_,
- CONCAT(cs.class_date_, ' ', cs.start_class_time_) course_start_time_,
- CONCAT(cs.class_date_, ' ', cs.end_class_time_) course_end_time_,
- ch.content_,
- ch.create_time_ homework_create_time_,
- sch.user_id_,
- sch.attachments_,
- sch.submit_time_,
- sch.is_replied_,
- 'HOMEWORK' homework_type_
- FROM
- student_course_homework sch
- LEFT JOIN course_homework ch ON ch.id_=sch.course_homework_id_
- LEFT JOIN course_schedule cs ON cs.id_=ch.course_schedule_id_
- LEFT JOIN sys_user tea ON cs.actual_teacher_id_=tea.id_
- WHERE
- sch.user_id_=#{studentId} AND cs.class_date_ BETWEEN #{monday} AND #{sunday})
- ORDER BY homework_create_time_ DESC
- <include refid="global.limit"/>
- </select>
- <select id="countStudentHomeworkDetailsInTimeZone" resultType="int">
- SELECT COUNT(t.id_) FROM (
- (SELECT
- eer.id_
- FROM
- extracurricular_exercises_reply eer
- WHERE
- eer.user_id_=#{studentId} AND DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday})
- UNION ALL
- (SELECT
- sch.id_
- FROM
- student_course_homework sch
- LEFT JOIN course_schedule cs ON cs.id_=sch.course_schedule_id_
- WHERE
- sch.user_id_=#{studentId} AND cs.class_date_ BETWEEN #{monday} AND #{sunday})
- ) t
- </select>
- <select id="getStudentExercisesWithTimeZone" resultMap="ExtracurricularExercisesReply">
- SELECT
- eer.id_,
- eer.user_id_,
- eer.status_,
- eer.submit_time_,
- eer.is_replied_,
- eer.is_replied_timely_,
- ee.teacher_id_ ee_teacher_id_,
- eer.music_score_id_
- FROM
- extracurricular_exercises_reply eer
- LEFT JOIN extracurricular_exercises ee ON eer.extracurricular_exercises_id_=ee.id_
- WHERE
- DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}
- </select>
- <select id="checkStudentHaveExercisesInDateRange" resultType="java.lang.Integer">
- SELECT
- DISTINCT user_id_
- FROM
- extracurricular_exercises_reply
- WHERE
- DATE_FORMAT( create_time_, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}
- AND user_id_ IN
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
- #{studentId}
- </foreach>
- </select>
- <sql id="getEduHomeworkListCondition">
- <where>
- EXISTS (SELECT user_id_ FROM student_registration sr
- LEFT JOIN music_group mg ON mg.id_=sr.music_group_id_
- WHERE sr.user_id_ = eer.user_id_ AND sr.music_group_status_='NORMAL'
- AND mg.status_ = 'PROGRESS' AND mg.transaction_teacher_id_=#{transactionTeacherId})
- <if test="search != null and search != ''">
- AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.id_ = #{search})
- </if>
- <if test="startTime!=null">
- AND DATE_FORMAT(ee.create_time_, "%Y-%m-%d") >= DATE_FORMAT(#{startTime}, "%Y-%m-%d")
- </if>
- <if test="endTime!=null">
- AND DATE_FORMAT(ee.create_time_, "%Y-%m-%d") <= DATE_FORMAT(#{endTime}, "%Y-%m-%d")
- </if>
- </where>
- </sql>
- <select id="getEduHomeworkList" resultType="com.ym.mec.biz.dal.dto.EduHomeworkCardDto">
- SELECT
- ee.id_ homeworkId,
- su.real_name_ teacherName,
- su.avatar_ teacherAvatar,
- ee.create_time_ createTime,
- COUNT( eer.user_id_ ) exceptStudentNum,
- SUM( eer.status_ ) submitStudentNum,
- SUM( eer.is_replied_ ) repliedStudentNum
- FROM
- extracurricular_exercises ee
- LEFT JOIN sys_user su ON ee.teacher_id_ = su.id_
- LEFT JOIN extracurricular_exercises_reply eer ON ee.id_ = eer.extracurricular_exercises_id_
- <include refid="getEduHomeworkListCondition" />
- GROUP BY ee.id_
- ORDER BY ee.create_time_ DESC
- <include refid="global.limit"></include>
- </select>
- <select id="countEduHomeworkList" resultType="int">
- SELECT
- COUNT(DISTINCT ee.id_)
- FROM
- extracurricular_exercises ee
- LEFT JOIN sys_user su ON ee.teacher_id_ = su.id_
- LEFT JOIN extracurricular_exercises_reply eer ON ee.id_ = eer.extracurricular_exercises_id_
- <include refid="getEduHomeworkListCondition" />
- </select>
- <select id="countEduHomeworkStudentNumWithMusicGroup"
- resultType="com.ym.mec.biz.dal.dto.EduHomeworkCardDto">
- SELECT
- sr.music_group_id_ groupId,
- COUNT( eer.user_id_ ) exceptStudentNum,
- SUM( eer.status_ ) submitStudentNum,
- SUM( eer.is_replied_ ) repliedStudentNum
- FROM
- extracurricular_exercises ee
- LEFT JOIN sys_user su ON ee.teacher_id_ = su.id_
- LEFT JOIN extracurricular_exercises_reply eer ON ee.id_ = eer.extracurricular_exercises_id_
- LEFT JOIN student_registration sr ON eer.user_id_ = sr.user_id_
- WHERE sr.music_group_status_='NORMAL'
- <if test="groupIds!=null and groupIds.size()>0">
- AND sr.music_group_id_ IN
- <foreach collection="groupIds" item="groupId" open="(" close=")" separator=",">
- #{groupId}
- </foreach>
- </if>
- <if test="startTime!=null">
- AND DATE_FORMAT(ee.create_time_, "%Y-%m-%d") >= DATE_FORMAT(#{startTime}, "%Y-%m-%d")
- </if>
- <if test="endTime!=null">
- AND DATE_FORMAT(ee.create_time_, "%Y-%m-%d") <= DATE_FORMAT(#{endTime}, "%Y-%m-%d")
- </if>
- GROUP BY sr.music_group_id_
- </select>
- <select id="countEduHomeworkSubjectStudentNumWithMusicGroup"
- resultType="com.ym.mec.biz.dal.dto.EduHomeworkCardDto">
- SELECT
- sr.actual_subject_id_ subjectId,
- COUNT( eer.user_id_ ) exceptStudentNum,
- SUM( eer.status_ ) submitStudentNum,
- SUM( eer.is_replied_ ) repliedStudentNum
- FROM
- extracurricular_exercises ee
- LEFT JOIN sys_user su ON ee.teacher_id_ = su.id_
- LEFT JOIN extracurricular_exercises_reply eer ON ee.id_ = eer.extracurricular_exercises_id_
- LEFT JOIN student_registration sr ON eer.user_id_ = sr.user_id_
- WHERE sr.music_group_status_='NORMAL'
- AND sr.music_group_id_ = #{groupId}
- <if test="startTime!=null">
- AND DATE_FORMAT(ee.create_time_, "%Y-%m-%d") >= DATE_FORMAT(#{startTime}, "%Y-%m-%d")
- </if>
- <if test="endTime!=null">
- AND DATE_FORMAT(ee.create_time_, "%Y-%m-%d") <= DATE_FORMAT(#{endTime}, "%Y-%m-%d")
- </if>
- GROUP BY sr.actual_subject_id_
- </select>
- </mapper>
|