|
@@ -6,803 +6,1000 @@
|
|
|
-->
|
|
|
<mapper namespace="com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao">
|
|
|
|
|
|
- <resultMap type="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" id="StudentExtracurricularExercisesSituation">
|
|
|
- <result column="id_" property="id" />
|
|
|
- <result column="student_id_" property="studentId" />
|
|
|
- <result column="week_of_year_" property="weekOfYear" />
|
|
|
- <result column="monday_" property="monday" />
|
|
|
- <result column="sunday_" property="sunday" />
|
|
|
- <result column="teacher_id_" property="teacherId" />
|
|
|
- <result column="expect_exercises_num_" property="expectExercisesNum" />
|
|
|
- <result column="actual_exercises_num_" property="actualExercisesNum" />
|
|
|
- <result column="exercises_reply_num_" property="exercisesReplyNum" />
|
|
|
- <result column="exercises_message_num_" property="exercisesMessageNum" />
|
|
|
- <result column="exercises_message_timely_num_" property="exercisesMessageTimelyNum" />
|
|
|
- <result column="create_time_" property="createTime" />
|
|
|
- <result column="update_time_" property="updateTime" />
|
|
|
- <result column="last_submit_time_" property="lastSubmitTime"/>
|
|
|
- <result column="serve_type_" property="serveType"/>
|
|
|
- <result column="course_ids_" property="courseIds"/>
|
|
|
- <result column="not_over_course_ids_" property="notOverCourseIds"/>
|
|
|
- <result column="not_over_course_num_" property="notOverCourseNum"/>
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation"
|
|
|
+ id="StudentExtracurricularExercisesSituation">
|
|
|
+ <result column="id_" property="id"/>
|
|
|
+ <result column="student_id_" property="studentId"/>
|
|
|
+ <result column="week_of_year_" property="weekOfYear"/>
|
|
|
+ <result column="monday_" property="monday"/>
|
|
|
+ <result column="sunday_" property="sunday"/>
|
|
|
+ <result column="teacher_id_" property="teacherId"/>
|
|
|
+ <result column="expect_exercises_num_" property="expectExercisesNum"/>
|
|
|
+ <result column="actual_exercises_num_" property="actualExercisesNum"/>
|
|
|
+ <result column="exercises_reply_num_" property="exercisesReplyNum"/>
|
|
|
+ <result column="exercises_message_num_" property="exercisesMessageNum"/>
|
|
|
+ <result column="exercises_message_timely_num_" property="exercisesMessageTimelyNum"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="update_time_" property="updateTime"/>
|
|
|
+ <result column="last_submit_time_" property="lastSubmitTime"/>
|
|
|
+ <result column="serve_type_" property="serveType"/>
|
|
|
+ <result column="course_ids_" property="courseIds"/>
|
|
|
+ <result column="not_over_course_ids_" property="notOverCourseIds"/>
|
|
|
+ <result column="not_over_course_num_" property="notOverCourseNum"/>
|
|
|
<result column="tenant_id_" property="tenantId"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <resultMap id="StudentExercisesSituationDto" type="com.ym.mec.biz.dal.dto.StudentExercisesSituationDto" extends="StudentExtracurricularExercisesSituation">
|
|
|
- <result column="student_name_" property="studentName"/>
|
|
|
- <result column="teacher_name_" property="teacherName"/>
|
|
|
- <result column="organ_name_" property="organName"/>
|
|
|
- <result column="exist_vip_course_" property="existVipCourse"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <select id="get" resultMap="StudentExtracurricularExercisesSituation" >
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 全查询 -->
|
|
|
- <select id="findAll" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ where tenant_id_ = #{tenantId} ORDER BY id_
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 向数据库增加一条记录 -->
|
|
|
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- <!--
|
|
|
- <selectKey resultClass="int" keyProperty="id" >
|
|
|
- SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
- </selectKey>
|
|
|
- -->
|
|
|
- INSERT INTO student_extracurricular_exercises_situation_ (id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
|
|
|
- actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
|
|
|
- exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
|
|
|
- serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_,tenant_id_)
|
|
|
- VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},
|
|
|
- #{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType},#{courseIds},#{notOverCourseIds},#{notOverCourseNum},#{tenantId})
|
|
|
- </insert>
|
|
|
-
|
|
|
- <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- INSERT INTO student_extracurricular_exercises_situation_ (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
|
|
|
- actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
|
|
|
- exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
|
|
|
- serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_,tenant_id_)
|
|
|
- VALUES
|
|
|
- <foreach collection="situations" item="situation" separator=",">
|
|
|
- (#{situation.studentId},#{situation.weekOfYear},#{situation.monday},#{situation.sunday},#{situation.teacherId},#{situation.expectExercisesNum},
|
|
|
- #{situation.actualExercisesNum},#{situation.exercisesReplyNum},#{situation.exercisesMessageNum},#{situation.exercisesMessageTimelyNum},
|
|
|
- NOW(),NOW(),#{situation.lastSubmitTime},#{situation.serveType},#{situation.courseIds},#{situation.notOverCourseIds},#{situation.notOverCourseNum},#{situation.tenantId})
|
|
|
- </foreach>
|
|
|
- </insert>
|
|
|
-
|
|
|
- <!-- 根据主键查询一条记录 -->
|
|
|
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
|
- UPDATE student_extracurricular_exercises_situation_
|
|
|
- <set>
|
|
|
- <if test="exercisesReplyNum != null">
|
|
|
- exercises_reply_num_ = #{exercisesReplyNum},
|
|
|
- </if>
|
|
|
- <if test="monday != null">
|
|
|
- monday_ = #{monday},
|
|
|
- </if>
|
|
|
- <if test="id != null">
|
|
|
- id_ = #{id},
|
|
|
- </if>
|
|
|
- <if test="weekOfYear != null">
|
|
|
- week_of_year_ = #{weekOfYear},
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNum != null">
|
|
|
- exercises_message_num_ = #{exercisesMessageNum},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- create_time_ = #{createTime},
|
|
|
- </if>
|
|
|
- <if test="teacherId != null">
|
|
|
- teacher_id_ = #{teacherId},
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNum != null">
|
|
|
- actual_exercises_num_ = #{actualExercisesNum},
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNum != null">
|
|
|
- exercises_message_timely_num_ = #{exercisesMessageTimelyNum},
|
|
|
- </if>
|
|
|
- <if test="studentId != null">
|
|
|
- student_id_ = #{studentId},
|
|
|
- </if>
|
|
|
- <if test="expectExercisesNum != null">
|
|
|
- expect_exercises_num_ = #{expectExercisesNum},
|
|
|
- </if>
|
|
|
- <if test="sunday != null">
|
|
|
- sunday_ = #{sunday},
|
|
|
- </if>
|
|
|
- <if test="lastSubmitTime!=null">
|
|
|
- last_submit_time_=#{lastSubmitTime},
|
|
|
- </if>
|
|
|
- <if test="serveType!=null">
|
|
|
- serve_type_=#{serveType},
|
|
|
- </if>
|
|
|
- <if test="courseIds!=null and courseIds!=''">
|
|
|
- course_ids_=#{courseIds},
|
|
|
- </if>
|
|
|
- <if test="notOverCourseIds!=null and notOverCourseIds!=''">
|
|
|
- not_over_course_ids_=#{notOverCourseIds},
|
|
|
- </if>
|
|
|
- <if test="notOverCourseNum!=null">
|
|
|
- not_over_course_num_=#{notOverCourseNum},
|
|
|
- </if>
|
|
|
- update_time_ = #{updateTime}
|
|
|
- </set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
|
|
|
- </update>
|
|
|
-
|
|
|
- <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
|
- <foreach collection="situations" item="situation" separator=";">
|
|
|
- UPDATE student_extracurricular_exercises_situation_
|
|
|
- <set>
|
|
|
- <if test="situation.exercisesReplyNum != null">
|
|
|
- exercises_reply_num_ = #{situation.exercisesReplyNum},
|
|
|
- </if>
|
|
|
- <if test="situation.monday != null">
|
|
|
- monday_ = #{situation.monday},
|
|
|
- </if>
|
|
|
- <if test="situation.weekOfYear != null">
|
|
|
- week_of_year_ = #{situation.weekOfYear},
|
|
|
- </if>
|
|
|
- <if test="situation.exercisesMessageNum != null">
|
|
|
- exercises_message_num_ = #{situation.exercisesMessageNum},
|
|
|
- </if>
|
|
|
- <if test="situation.teacherId != null">
|
|
|
- teacher_id_ = #{situation.teacherId},
|
|
|
- </if>
|
|
|
- <if test="situation.actualExercisesNum != null">
|
|
|
- actual_exercises_num_ = #{situation.actualExercisesNum},
|
|
|
- </if>
|
|
|
- <if test="situation.exercisesMessageTimelyNum != null">
|
|
|
- exercises_message_timely_num_ = #{situation.exercisesMessageTimelyNum},
|
|
|
- </if>
|
|
|
- <if test="situation.studentId != null">
|
|
|
- student_id_ = #{situation.studentId},
|
|
|
- </if>
|
|
|
- <if test="situation.expectExercisesNum != null">
|
|
|
- expect_exercises_num_ = #{situation.expectExercisesNum},
|
|
|
- </if>
|
|
|
- <if test="situation.sunday != null">
|
|
|
- sunday_ = #{situation.sunday},
|
|
|
- </if>
|
|
|
- <if test="situation.lastSubmitTime!=null">
|
|
|
- last_submit_time_=#{situation.lastSubmitTime},
|
|
|
- </if>
|
|
|
- <if test="situation.serveType!=null">
|
|
|
- serve_type_=#{situation.serveType},
|
|
|
- </if>
|
|
|
- <if test="situation.courseIds!=null">
|
|
|
- course_ids_=#{situation.courseIds},
|
|
|
- </if>
|
|
|
- <if test="situation.notOverCourseIds!=null and situation.notOverCourseIds!=''">
|
|
|
- not_over_course_ids_=#{situation.notOverCourseIds},
|
|
|
- </if>
|
|
|
- <if test="situation.notOverCourseNum!=null">
|
|
|
- not_over_course_num_=#{situation.notOverCourseNum},
|
|
|
- </if>
|
|
|
- update_time_ = NOW()
|
|
|
- </set> WHERE id_ = #{situation.id} and tenant_id_ = #{situation.tenantId}
|
|
|
- </foreach>
|
|
|
- </update>
|
|
|
-
|
|
|
- <!-- 根据主键删除一条记录 -->
|
|
|
- <delete id="delete" >
|
|
|
- DELETE FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
|
- </delete>
|
|
|
- <delete id="deleteByMonday">
|
|
|
- DELETE FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
|
- <if test="studentIds!=null and studentIds.size()>0">
|
|
|
- AND student_id_ IN
|
|
|
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
- #{studentId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </delete>
|
|
|
- <select id="selectByMonday" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT id_,course_ids_ FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
|
- <if test="studentIds!=null and studentIds.size()>0">
|
|
|
- AND student_id_ IN
|
|
|
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
- #{studentId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </select>
|
|
|
- <delete id="deleteByStudent">
|
|
|
- DELETE FROM student_extracurricular_exercises_situation_ WHERE student_id_ = #{studentId}
|
|
|
- <if test="monday!=null and monday!=''">
|
|
|
- AND monday_=#{monday}
|
|
|
- </if>
|
|
|
- </delete>
|
|
|
- <delete id="batchDelete">
|
|
|
- DELETE FROM student_extracurricular_exercises_situation_ WHERE id_ IN
|
|
|
- <foreach collection="situationIds" item="id" open="(" close=")" separator=",">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </delete>
|
|
|
-
|
|
|
- <select id="selectByStudent" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT id_,course_ids_ FROM student_extracurricular_exercises_situation_ WHERE student_id_ = #{studentId}
|
|
|
- <if test="monday!=null and monday!=''">
|
|
|
- AND monday_=#{monday}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 分页查询 -->
|
|
|
- <select id="queryPage" resultMap="StudentExtracurricularExercisesSituation" parameterType="map">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ where tenant_id_ = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 查询当前表的总记录数 -->
|
|
|
- <select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM student_extracurricular_exercises_situation_ where tenant_id_ = #{tenantId}
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findExercisesSituations" resultMap="StudentExercisesSituationDto">
|
|
|
- SELECT
|
|
|
- sees.id_ id_,
|
|
|
- student_id_,
|
|
|
- stu.username_ student_name_,
|
|
|
- tea.real_name_ teacher_name_,
|
|
|
- o.name_ organ_name_,
|
|
|
- sees.monday_,
|
|
|
- sees.sunday_,
|
|
|
- sees.serve_type_,
|
|
|
- sees.course_ids_,
|
|
|
- expect_exercises_num_ expect_exercises_num_,
|
|
|
- actual_exercises_num_ actual_exercises_num_,
|
|
|
- <if test="submitStartDate==null or submitEndDate==null">
|
|
|
- exercises_reply_num_ exercises_reply_num_,
|
|
|
- exercises_message_num_ exercises_message_num_,
|
|
|
- exercises_message_timely_num_ exercises_message_timely_num_,
|
|
|
- last_submit_time_ last_submit_time_
|
|
|
- </if>
|
|
|
- <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
- IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0) exercises_reply_num_,
|
|
|
- IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) exercises_message_num_,
|
|
|
- IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0) exercises_message_timely_num_,
|
|
|
- IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},last_submit_time_, NULL) last_submit_time_
|
|
|
- </if>
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
- LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
- LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
- LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
- WHERE
|
|
|
- sees.monday_ >= #{monday}
|
|
|
- AND sees.sunday_ <= #{sunday} and sees.tenant_id_ = #{tenantId}
|
|
|
- <if test="teacherId!=null">
|
|
|
- AND sees.teacher_id_ = #{teacherId}
|
|
|
- </if>
|
|
|
- <if test="search!=null">
|
|
|
- AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
- </if>
|
|
|
- <if test="organId != null and organId != ''">
|
|
|
- AND FIND_IN_SET(t.organ_id_,#{organId})
|
|
|
- </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_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </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_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </if>
|
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </if>
|
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==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_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="expectExercisesNum!=null">
|
|
|
- AND expect_exercises_num_ = #{expectExercisesNum}
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
- AND actual_exercises_num_ < expect_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
- AND actual_exercises_num_ >= expect_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="submitStartDate==null or submitEndDate==null">
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
- AND exercises_reply_num_ < actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
- AND exercises_reply_num_ >= actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
- AND exercises_message_num_ < exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="serviceIsError!=null and serviceIsError">
|
|
|
- AND (actual_exercises_num_ < expect_exercises_num_ OR exercises_message_num_ < exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
- AND exercises_message_num_ >= exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
- AND exercises_message_timely_num_ < exercises_message_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
- AND exercises_message_timely_num_ >= exercises_message_num_
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0) < actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0) >= actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="serviceIsError!=null and serviceIsError">
|
|
|
- AND (actual_exercises_num_ < expect_exercises_num_ OR IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) >= exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0) < exercises_message_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0) >= exercises_message_num_
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- ORDER BY student_id_
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countExercisesSituations" resultType="int">
|
|
|
- SELECT COUNT(1) FROM (
|
|
|
- SELECT
|
|
|
- 1
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
- LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
- LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
- LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
- WHERE
|
|
|
- sees.monday_ >= #{monday}
|
|
|
- AND sees.sunday_ <= #{sunday} and sees.tenant_id_ = #{tenantId}
|
|
|
- <if test="teacherId!=null">
|
|
|
- AND sees.teacher_id_ = #{teacherId}
|
|
|
- </if>
|
|
|
- <if test="search!=null">
|
|
|
- AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
- </if>
|
|
|
- <if test="organId != null and organId != ''">
|
|
|
- AND FIND_IN_SET(t.organ_id_, #{organId})
|
|
|
- </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_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </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_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </if>
|
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
- AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </if>
|
|
|
- <if test="existPracticeCourse!=null and existPracticeCourse==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_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="expectExercisesNum!=null">
|
|
|
- AND expect_exercises_num_ = #{expectExercisesNum}
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
- AND actual_exercises_num_ < expect_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
- AND actual_exercises_num_ >= expect_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="submitStartDate==null or submitEndDate==null">
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
- AND exercises_reply_num_ < actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
- AND exercises_reply_num_ >= actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
- AND exercises_message_num_ < exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="serviceIsError!=null and serviceIsError">
|
|
|
- AND (actual_exercises_num_ < expect_exercises_num_ OR exercises_message_num_ < exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
- AND exercises_message_num_ >= exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
- AND exercises_message_timely_num_ < exercises_message_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
- AND exercises_message_timely_num_ >= exercises_message_num_
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0) < actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_reply_num_,0) >= actual_exercises_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="serviceIsError!=null and serviceIsError">
|
|
|
- AND (actual_exercises_num_ < expect_exercises_num_ OR IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) >= exercises_reply_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0) < exercises_message_num_
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
- AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_timely_num_,0) >= exercises_message_num_
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- ) tmp
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findExercisesSituationsById" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ WHERE id_ IN
|
|
|
- <foreach collection="ids" item="id" separator="," open="(" close=")">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findTeacherExercisesServiceSituations" resultType="com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto">
|
|
|
- SELECT
|
|
|
- teacher_id_ teacherId,
|
|
|
- COUNT( exercises_reply_num_ ) expectExercisesNum,
|
|
|
- COUNT( CASE WHEN actual_exercises_num_ = 1 THEN 1 ELSE NULL END ) actualExercisesNum
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_
|
|
|
- FORCE INDEX(monday_)
|
|
|
- WHERE monday_ = #{monday}
|
|
|
- AND teacher_id_ IN
|
|
|
- <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
|
|
|
- #{teacherId}
|
|
|
- </foreach>
|
|
|
- GROUP BY
|
|
|
- teacher_id_;
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findLastWeekTodayUpdateNum" resultType="int">
|
|
|
- SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE sunday_=#{sunday} AND DATE_FORMAT(update_time_,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="StudentExercisesSituationDto" type="com.ym.mec.biz.dal.dto.StudentExercisesSituationDto"
|
|
|
+ extends="StudentExtracurricularExercisesSituation">
|
|
|
+ <result column="student_name_" property="studentName"/>
|
|
|
+ <result column="teacher_name_" property="teacherName"/>
|
|
|
+ <result column="organ_name_" property="organName"/>
|
|
|
+ <result column="exist_vip_course_" property="existVipCourse"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT *
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE id_ = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT *
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ where tenant_id_ = #{tenantId}
|
|
|
+ ORDER BY id_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation"
|
|
|
+ useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ <!--
|
|
|
+ <selectKey resultClass="int" keyProperty="id" >
|
|
|
+ SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
+ </selectKey>
|
|
|
+ -->
|
|
|
+ INSERT INTO student_extracurricular_exercises_situation_
|
|
|
+ (id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
|
|
|
+ actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
|
|
|
+ exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
|
|
|
+ serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_,tenant_id_)
|
|
|
+ VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},
|
|
|
+ #{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType},#{courseIds},#{notOverCourseIds},#{notOverCourseNum},#{tenantId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation"
|
|
|
+ useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO student_extracurricular_exercises_situation_
|
|
|
+ (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
|
|
|
+ actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
|
|
|
+ exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
|
|
|
+ serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_,tenant_id_)
|
|
|
+ VALUES
|
|
|
+ <foreach collection="situations" item="situation" separator=",">
|
|
|
+ (#{situation.studentId},#{situation.weekOfYear},#{situation.monday},#{situation.sunday},#{situation.teacherId},#{situation.expectExercisesNum},
|
|
|
+ #{situation.actualExercisesNum},#{situation.exercisesReplyNum},#{situation.exercisesMessageNum},#{situation.exercisesMessageTimelyNum},
|
|
|
+ NOW(),NOW(),#{situation.lastSubmitTime},#{situation.serveType},#{situation.courseIds},#{situation.notOverCourseIds},#{situation.notOverCourseNum},#{situation.tenantId})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
|
+ UPDATE student_extracurricular_exercises_situation_
|
|
|
+ <set>
|
|
|
+ <if test="exercisesReplyNum != null">
|
|
|
+ exercises_reply_num_ = #{exercisesReplyNum},
|
|
|
+ </if>
|
|
|
+ <if test="monday != null">
|
|
|
+ monday_ = #{monday},
|
|
|
+ </if>
|
|
|
+ <if test="id != null">
|
|
|
+ id_ = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="weekOfYear != null">
|
|
|
+ week_of_year_ = #{weekOfYear},
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNum != null">
|
|
|
+ exercises_message_num_ = #{exercisesMessageNum},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="teacherId != null">
|
|
|
+ teacher_id_ = #{teacherId},
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNum != null">
|
|
|
+ actual_exercises_num_ = #{actualExercisesNum},
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNum != null">
|
|
|
+ exercises_message_timely_num_ = #{exercisesMessageTimelyNum},
|
|
|
+ </if>
|
|
|
+ <if test="studentId != null">
|
|
|
+ student_id_ = #{studentId},
|
|
|
+ </if>
|
|
|
+ <if test="expectExercisesNum != null">
|
|
|
+ expect_exercises_num_ = #{expectExercisesNum},
|
|
|
+ </if>
|
|
|
+ <if test="sunday != null">
|
|
|
+ sunday_ = #{sunday},
|
|
|
+ </if>
|
|
|
+ <if test="lastSubmitTime!=null">
|
|
|
+ last_submit_time_=#{lastSubmitTime},
|
|
|
+ </if>
|
|
|
+ <if test="serveType!=null">
|
|
|
+ serve_type_=#{serveType},
|
|
|
+ </if>
|
|
|
+ <if test="courseIds!=null and courseIds!=''">
|
|
|
+ course_ids_=#{courseIds},
|
|
|
+ </if>
|
|
|
+ <if test="notOverCourseIds!=null and notOverCourseIds!=''">
|
|
|
+ not_over_course_ids_=#{notOverCourseIds},
|
|
|
+ </if>
|
|
|
+ <if test="notOverCourseNum!=null">
|
|
|
+ not_over_course_num_=#{notOverCourseNum},
|
|
|
+ </if>
|
|
|
+ update_time_ = #{updateTime}
|
|
|
+ </set>
|
|
|
+ WHERE id_ = #{id} and tenant_id_ = #{tenantId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
|
+ <foreach collection="situations" item="situation" separator=";">
|
|
|
+ UPDATE student_extracurricular_exercises_situation_
|
|
|
+ <set>
|
|
|
+ <if test="situation.exercisesReplyNum != null">
|
|
|
+ exercises_reply_num_ = #{situation.exercisesReplyNum},
|
|
|
+ </if>
|
|
|
+ <if test="situation.monday != null">
|
|
|
+ monday_ = #{situation.monday},
|
|
|
+ </if>
|
|
|
+ <if test="situation.weekOfYear != null">
|
|
|
+ week_of_year_ = #{situation.weekOfYear},
|
|
|
+ </if>
|
|
|
+ <if test="situation.exercisesMessageNum != null">
|
|
|
+ exercises_message_num_ = #{situation.exercisesMessageNum},
|
|
|
+ </if>
|
|
|
+ <if test="situation.teacherId != null">
|
|
|
+ teacher_id_ = #{situation.teacherId},
|
|
|
+ </if>
|
|
|
+ <if test="situation.actualExercisesNum != null">
|
|
|
+ actual_exercises_num_ = #{situation.actualExercisesNum},
|
|
|
+ </if>
|
|
|
+ <if test="situation.exercisesMessageTimelyNum != null">
|
|
|
+ exercises_message_timely_num_ = #{situation.exercisesMessageTimelyNum},
|
|
|
+ </if>
|
|
|
+ <if test="situation.studentId != null">
|
|
|
+ student_id_ = #{situation.studentId},
|
|
|
+ </if>
|
|
|
+ <if test="situation.expectExercisesNum != null">
|
|
|
+ expect_exercises_num_ = #{situation.expectExercisesNum},
|
|
|
+ </if>
|
|
|
+ <if test="situation.sunday != null">
|
|
|
+ sunday_ = #{situation.sunday},
|
|
|
+ </if>
|
|
|
+ <if test="situation.lastSubmitTime!=null">
|
|
|
+ last_submit_time_=#{situation.lastSubmitTime},
|
|
|
+ </if>
|
|
|
+ <if test="situation.serveType!=null">
|
|
|
+ serve_type_=#{situation.serveType},
|
|
|
+ </if>
|
|
|
+ <if test="situation.courseIds!=null">
|
|
|
+ course_ids_=#{situation.courseIds},
|
|
|
+ </if>
|
|
|
+ <if test="situation.notOverCourseIds!=null and situation.notOverCourseIds!=''">
|
|
|
+ not_over_course_ids_=#{situation.notOverCourseIds},
|
|
|
+ </if>
|
|
|
+ <if test="situation.notOverCourseNum!=null">
|
|
|
+ not_over_course_num_=#{situation.notOverCourseNum},
|
|
|
+ </if>
|
|
|
+ update_time_ = NOW()
|
|
|
+ </set>
|
|
|
+ WHERE id_ = #{situation.id} and tenant_id_ = #{situation.tenantId}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE id_ = #{id}
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteByMonday">
|
|
|
+ DELETE FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
|
+ <if test="studentIds!=null and studentIds.size()>0">
|
|
|
+ AND student_id_ IN
|
|
|
+ <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
+ #{studentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </delete>
|
|
|
+ <select id="selectByMonday" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT id_,course_ids_ FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
|
+ <if test="studentIds!=null and studentIds.size()>0">
|
|
|
+ AND student_id_ IN
|
|
|
+ <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
+ #{studentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByStudent">
|
|
|
+ DELETE FROM student_extracurricular_exercises_situation_ WHERE student_id_ = #{studentId}
|
|
|
+ <if test="monday!=null and monday!=''">
|
|
|
+ AND monday_=#{monday}
|
|
|
+ </if>
|
|
|
+ </delete>
|
|
|
+ <delete id="batchDelete">
|
|
|
+ DELETE FROM student_extracurricular_exercises_situation_ WHERE id_ IN
|
|
|
+ <foreach collection="situationIds" item="id" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectByStudent" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT id_,course_ids_ FROM student_extracurricular_exercises_situation_ WHERE student_id_ = #{studentId}
|
|
|
+ <if test="monday!=null and monday!=''">
|
|
|
+ AND monday_=#{monday}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="StudentExtracurricularExercisesSituation" parameterType="map">
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_ where tenant_id_ = #{tenantId} ORDER BY id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ where tenant_id_ = #{tenantId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findExercisesSituations" resultMap="StudentExercisesSituationDto">
|
|
|
+ SELECT
|
|
|
+ sees.id_ id_,
|
|
|
+ student_id_,
|
|
|
+ stu.username_ student_name_,
|
|
|
+ tea.real_name_ teacher_name_,
|
|
|
+ o.name_ organ_name_,
|
|
|
+ sees.monday_,
|
|
|
+ sees.sunday_,
|
|
|
+ sees.serve_type_,
|
|
|
+ sees.course_ids_,
|
|
|
+ expect_exercises_num_ expect_exercises_num_,
|
|
|
+ actual_exercises_num_ actual_exercises_num_,
|
|
|
+ <if test="submitStartDate==null or submitEndDate==null">
|
|
|
+ exercises_reply_num_ exercises_reply_num_,
|
|
|
+ exercises_message_num_ exercises_message_num_,
|
|
|
+ exercises_message_timely_num_ exercises_message_timely_num_,
|
|
|
+ last_submit_time_ last_submit_time_
|
|
|
+ </if>
|
|
|
+ <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
+ IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_reply_num_,0) exercises_reply_num_,
|
|
|
+ IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_num_,0) exercises_message_num_,
|
|
|
+ IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_timely_num_,0) exercises_message_timely_num_,
|
|
|
+ IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},last_submit_time_, NULL) last_submit_time_
|
|
|
+ </if>
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
+ LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
+ LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
+ LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
+ WHERE
|
|
|
+ sees.monday_ >= #{monday}
|
|
|
+ AND sees.sunday_ <= #{sunday} and sees.tenant_id_ = #{tenantId}
|
|
|
+ <if test="teacherId!=null">
|
|
|
+ AND sees.teacher_id_ = #{teacherId}
|
|
|
+ </if>
|
|
|
+ <if test="search!=null">
|
|
|
+ AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(t.organ_id_,#{organId})
|
|
|
+ </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_=sees.student_id_ AND cssp.group_type_='VIP' AND
|
|
|
+ class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
+ </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_=sees.student_id_ AND cssp.group_type_='VIP' AND
|
|
|
+ class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
+ </if>
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
+ AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON
|
|
|
+ cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE
|
|
|
+ cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN
|
|
|
+ #{monday} AND #{sunday})
|
|
|
+ </if>
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==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_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE
|
|
|
+ cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN
|
|
|
+ #{monday} AND #{sunday})
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="expectExercisesNum!=null">
|
|
|
+ AND expect_exercises_num_ = #{expectExercisesNum}
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
+ AND actual_exercises_num_ < expect_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
+ AND actual_exercises_num_ >= expect_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="submitStartDate==null or submitEndDate==null">
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
+ AND exercises_reply_num_ < actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
+ AND exercises_reply_num_ >= actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
+ AND exercises_message_num_ < exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="serviceIsError!=null and serviceIsError">
|
|
|
+ AND (actual_exercises_num_ < expect_exercises_num_ OR exercises_message_num_ <
|
|
|
+ exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
+ AND exercises_message_num_ >= exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
+ AND exercises_message_timely_num_ < exercises_message_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
+ AND exercises_message_timely_num_ >= exercises_message_num_
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_reply_num_,0) < actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_reply_num_,0) >= actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="serviceIsError!=null and serviceIsError">
|
|
|
+ AND (actual_exercises_num_ < expect_exercises_num_ OR IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d')
|
|
|
+ BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_num_,0) >= exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_timely_num_,0) < exercises_message_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_timely_num_,0) >= exercises_message_num_
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ ORDER BY student_id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countExercisesSituations" resultType="int">
|
|
|
+ SELECT COUNT(1) FROM (
|
|
|
+ SELECT
|
|
|
+ 1
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
|
|
|
+ LEFT JOIN teacher t ON t.id_=sees.teacher_id_
|
|
|
+ LEFT JOIN sys_user tea ON tea.id_=sees.teacher_id_
|
|
|
+ LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
+ WHERE
|
|
|
+ sees.monday_ >= #{monday}
|
|
|
+ AND sees.sunday_ <= #{sunday} and sees.tenant_id_ = #{tenantId}
|
|
|
+ <if test="teacherId!=null">
|
|
|
+ AND sees.teacher_id_ = #{teacherId}
|
|
|
+ </if>
|
|
|
+ <if test="search!=null">
|
|
|
+ AND (stu.id_=#{search} OR stu.username_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(t.organ_id_, #{organId})
|
|
|
+ </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_=sees.student_id_ AND cssp.group_type_='VIP' AND
|
|
|
+ class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
+ </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_=sees.student_id_ AND cssp.group_type_='VIP' AND
|
|
|
+ class_date_ BETWEEN #{monday} AND #{sunday})
|
|
|
+ </if>
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==1">
|
|
|
+ AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON
|
|
|
+ cs.id_=cssp.course_schedule_id_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE
|
|
|
+ cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN
|
|
|
+ #{monday} AND #{sunday})
|
|
|
+ </if>
|
|
|
+ <if test="existPracticeCourse!=null and existPracticeCourse==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_ LEFT JOIN practice_group pg ON pg.id_=cssp.music_group_id_ WHERE
|
|
|
+ cssp.user_id_=sees.student_id_ AND cssp.group_type_='PRACTICE' AND pg.type_='CHARGE' AND class_date_ BETWEEN
|
|
|
+ #{monday} AND #{sunday})
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="expectExercisesNum!=null">
|
|
|
+ AND expect_exercises_num_ = #{expectExercisesNum}
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
+ AND actual_exercises_num_ < expect_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
+ AND actual_exercises_num_ >= expect_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="submitStartDate==null or submitEndDate==null">
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
+ AND exercises_reply_num_ < actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
+ AND exercises_reply_num_ >= actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
+ AND exercises_message_num_ < exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="serviceIsError!=null and serviceIsError">
|
|
|
+ AND (actual_exercises_num_ < expect_exercises_num_ OR exercises_message_num_ <
|
|
|
+ exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
+ AND exercises_message_num_ >= exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
+ AND exercises_message_timely_num_ < exercises_message_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
+ AND exercises_message_timely_num_ >= exercises_message_num_
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="submitStartDate!=null and submitEndDate!=null">
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_reply_num_,0) < actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_reply_num_,0) >= actual_exercises_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="serviceIsError!=null and serviceIsError">
|
|
|
+ AND (actual_exercises_num_ < expect_exercises_num_ OR IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d')
|
|
|
+ BETWEEN #{submitStartDate} AND #{submitEndDate},exercises_message_num_,0) < exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_num_,0) >= exercises_reply_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_timely_num_,0) < exercises_message_num_
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
+ AND IF(DATE_FORMAT(last_submit_time_, '%Y-%m-%d') BETWEEN #{submitStartDate} AND
|
|
|
+ #{submitEndDate},exercises_message_timely_num_,0) >= exercises_message_num_
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ ) tmp
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findExercisesSituationsById" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_ WHERE id_ IN
|
|
|
+ <foreach collection="ids" item="id" separator="," open="(" close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findTeacherExercisesServiceSituations" resultType="com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto">
|
|
|
+ SELECT
|
|
|
+ teacher_id_ teacherId,
|
|
|
+ COUNT( exercises_reply_num_ ) expectExercisesNum,
|
|
|
+ COUNT( CASE WHEN actual_exercises_num_ = 1 THEN 1 ELSE NULL END ) actualExercisesNum
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_
|
|
|
+ FORCE INDEX(monday_)
|
|
|
+ WHERE monday_ = #{monday}
|
|
|
+ AND teacher_id_ IN
|
|
|
+ <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
|
|
|
+ #{teacherId}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY
|
|
|
+ teacher_id_;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findLastWeekTodayUpdateNum" resultType="int">
|
|
|
+ SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE sunday_=#{sunday} AND
|
|
|
+ DATE_FORMAT(update_time_,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
<if test="tenantId != null">
|
|
|
- and tenant_id_ = #{tenantId}
|
|
|
+ and tenant_id_ = #{tenantId}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="findStudentExercisesSituationsWithMonDay" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday} AND student_id_=#{studentId}
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getNoFinishedServiceTeacher" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
- teacher_id_ AS 'key',
|
|
|
- COUNT( student_id_ ) AS 'value'
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_
|
|
|
- WHERE
|
|
|
- actual_exercises_num_ = 0
|
|
|
- AND serve_type_ = 'EXERCISE'
|
|
|
- AND monday_ = #{monday}
|
|
|
- AND teacher_id_ IS NOT NULL
|
|
|
- GROUP BY
|
|
|
- teacher_id_
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countWeekServiceNum" resultType="int">
|
|
|
- SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday}
|
|
|
+ <select id="findStudentExercisesSituationsWithMonDay" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT *
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE monday_ = #{monday}
|
|
|
+ AND student_id_ = #{studentId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getNoFinishedServiceTeacher" resultType="java.util.Map">
|
|
|
+ SELECT teacher_id_ AS 'key', COUNT( student_id_ ) AS 'value'
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE actual_exercises_num_ = 0
|
|
|
+ AND serve_type_ = 'EXERCISE'
|
|
|
+ AND monday_ = #{monday}
|
|
|
+ AND teacher_id_ IS NOT NULL
|
|
|
+ GROUP BY teacher_id_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countWeekServiceNum" resultType="int">
|
|
|
+ SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday}
|
|
|
<if test="tenantId != null">
|
|
|
- and tenant_id_ = #{tenantId}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findWeekServiceWithStudents" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_
|
|
|
- <where>
|
|
|
- teacher_id_=#{teacherId}
|
|
|
- <if test="monday != null and monday != ''">
|
|
|
- AND monday_ = #{monday}
|
|
|
- </if>
|
|
|
- <if test="studentIds!=null and studentIds.size()>0">
|
|
|
- AND student_id_ IN
|
|
|
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
- #{studentId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
+ and tenant_id_ = #{tenantId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findWeekServiceWithStudents" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_
|
|
|
+ <where>
|
|
|
+ teacher_id_=#{teacherId}
|
|
|
+ <if test="monday != null and monday != ''">
|
|
|
+ AND monday_ = #{monday}
|
|
|
+ </if>
|
|
|
+ <if test="studentIds!=null and studentIds.size()>0">
|
|
|
+ AND student_id_ IN
|
|
|
+ <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
+ #{studentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
<select id="findTeacherNoStartServices" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ WHERE teacher_id_=#{teacherId} AND actual_exercises_num_<=0 AND serve_type_='HOMEWORK';
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <select id="getTeacherHomeworkCourseIdsWithMonday" resultType="string">
|
|
|
- SELECT course_ids_ FROM student_extracurricular_exercises_situation_
|
|
|
- WHERE teacher_id_=#{teacherId}
|
|
|
- AND serve_type_='HOMEWORK'
|
|
|
- <if test="monday!=null and monday!=''">
|
|
|
- AND monday_=#{monday}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findServiceWithCourse"
|
|
|
- resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday} AND FIND_IN_SET(#{courseId}, course_ids_)
|
|
|
- </select>
|
|
|
-
|
|
|
- <resultMap id="TeacherServeDto" type="com.ym.mec.biz.dal.dto.TeacherServeDto">
|
|
|
- <result column="organ_name_" property="organName"/>
|
|
|
- <result column="monday_" property="monday"/>
|
|
|
- <result column="sunday_" property="sunday"/>
|
|
|
- <result column="teacher_id_" property="teacherId"/>
|
|
|
- <result column="teacher_name_" property="teacherName"/>
|
|
|
- <result column="homework_num_" property="homeworkNum"/>
|
|
|
- <result column="exercise_num_" property="exerciseNum"/>
|
|
|
- <result column="un_done_" property="unDone"/>
|
|
|
- <result column="remind_time_" property="remindDate"/>
|
|
|
- <result column="operator_name_" property="operatorName"/>
|
|
|
- <result column="job_nature_" property="jobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
- <result column="expect_exercises_num_" property="expectExercisesNum" />
|
|
|
- <result column="actual_exercises_num_" property="actualExercisesNum" />
|
|
|
- <result column="exercises_reply_num_" property="exercisesReplyNum" />
|
|
|
- <result column="exercises_message_num_" property="exercisesMessageNum" />
|
|
|
- <result column="exercises_message_timely_num_" property="exercisesMessageTimelyNum" />
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <sql id="queryTeacherServeInfoCondition">
|
|
|
- <where>
|
|
|
- sees.tenant_id_ = #{tenantId}
|
|
|
- <if test="organIds != null and organIds.size()>0">
|
|
|
- AND tea.organ_id_ IN
|
|
|
- <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
|
- #{organId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="monday!=null and monday!='' and sunday!=null and sunday!=''">
|
|
|
- AND sees.monday_ BETWEEN #{monday} AND #{sunday}
|
|
|
- </if>
|
|
|
- <if test="teacherId!=null">
|
|
|
- AND sees.teacher_id_ = #{teacherId}
|
|
|
- </if>
|
|
|
- <if test="reminded!=null and reminded==0">
|
|
|
- AND NOT EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
|
|
|
- </if>
|
|
|
- <if test="reminded!=null and reminded==1">
|
|
|
- AND EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
|
|
|
- </if>
|
|
|
- <if test="operatorId!=null">
|
|
|
- AND EXISTS (SELECT id_ FROM teacher_remind WHERE operator_id_=#{operatorId} AND teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
|
|
|
- </if>
|
|
|
- <if test="jobNature!=null">
|
|
|
- AND tea.job_nature_=#{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="queryTeacherServeInfo" resultMap="TeacherServeDto">
|
|
|
- SELECT
|
|
|
- organ.name_ organ_name_,
|
|
|
- sees.monday_,
|
|
|
- sees.sunday_,
|
|
|
- sees.teacher_id_,
|
|
|
- su.real_name_ teacher_name_,
|
|
|
- tea.job_nature_,
|
|
|
- SUM(expect_exercises_num_) expect_exercises_num_,
|
|
|
- SUM(actual_exercises_num_) actual_exercises_num_,
|
|
|
- SUM(exercises_reply_num_) exercises_reply_num_,
|
|
|
- SUM(exercises_message_num_) exercises_message_num_,
|
|
|
- SUM(exercises_message_timely_num_) exercises_message_timely_num_,
|
|
|
- SUM(CASE sees.serve_type_ WHEN 'HOMEWORK' THEN sees.expect_exercises_num_ ELSE 0 END) homework_num_,
|
|
|
- SUM(CASE sees.serve_type_ WHEN 'EXERCISE' THEN 1 ELSE 0 END) exercise_num_,
|
|
|
- SUM( sees.expect_exercises_num_-sees.not_over_course_num_ )> SUM( sees.actual_exercises_num_ ) un_done_
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
|
|
|
- LEFT JOIN organization organ ON organ.id_=tea.organ_id_
|
|
|
- LEFT JOIN sys_user su ON tea.id_=su.id_
|
|
|
- <include refid="queryTeacherServeInfoCondition" />
|
|
|
- GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
- <trim prefix="HAVING" prefixOverrides="AND">
|
|
|
- <if test="unDone!=null">
|
|
|
- <if test="unDone==1">
|
|
|
- AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) > SUM( sees.actual_exercises_num_ )
|
|
|
- </if>
|
|
|
- <if test="unDone==0">
|
|
|
- AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) <= SUM( sees.actual_exercises_num_ )
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
- AND SUM(actual_exercises_num_) < SUM(expect_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
- AND SUM(actual_exercises_num_) >= SUM(expect_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
- AND SUM(exercises_reply_num_) < SUM(actual_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
- AND SUM(exercises_reply_num_) >= SUM(actual_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
- AND SUM(exercises_message_num_) < SUM(exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="serviceIsError!=null and serviceIsError">
|
|
|
- AND (SUM(actual_exercises_num_) < SUM(expect_exercises_num_) OR SUM(exercises_message_num_) < SUM(exercises_reply_num_))
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
- AND SUM(exercises_message_num_) >= SUM(exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
- AND SUM(exercises_message_timely_num_) < SUM(exercises_message_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
- AND SUM(exercises_message_timely_num_) >= SUM(exercises_message_num_)
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
- <include refid="global.limit"></include>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countTeacherServeInfo" resultType="int">
|
|
|
- SELECT COUNT(1) FROM (
|
|
|
- SELECT
|
|
|
- sees.id_
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
|
|
|
- <include refid="queryTeacherServeInfoCondition" />
|
|
|
- GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
- <trim prefix="HAVING" prefixOverrides="AND">
|
|
|
- <if test="unDone!=null">
|
|
|
- <if test="unDone==1">
|
|
|
- AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) > SUM( sees.actual_exercises_num_ )
|
|
|
- </if>
|
|
|
- <if test="unDone==0">
|
|
|
- AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) <= SUM( sees.actual_exercises_num_ )
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
- AND SUM(actual_exercises_num_) < SUM(expect_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
- AND SUM(actual_exercises_num_) >= SUM(expect_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
- AND SUM(exercises_reply_num_) < SUM(actual_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
- AND SUM(exercises_reply_num_) >= SUM(actual_exercises_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
- AND SUM(exercises_message_num_) < SUM(exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="serviceIsError!=null and serviceIsError">
|
|
|
- AND (SUM(actual_exercises_num_) < SUM(expect_exercises_num_) OR SUM(exercises_message_num_) < SUM(exercises_reply_num_))
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
- AND SUM(exercises_message_num_) >= SUM(exercises_reply_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
- AND SUM(exercises_message_timely_num_) < SUM(exercises_message_num_)
|
|
|
- </if>
|
|
|
- <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
- AND SUM(exercises_message_timely_num_) >= SUM(exercises_message_num_)
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
- ) e
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="findTeacherServeWithDate" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
- SELECT * FROM student_extracurricular_exercises_situation_
|
|
|
- WHERE monday_ BETWEEN #{monday} AND #{sunday}
|
|
|
- <if test="serveType!=null and serveType!=''">
|
|
|
- AND serve_type_=#{serveType}
|
|
|
- </if>
|
|
|
- AND teacher_id_ IN
|
|
|
- <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
|
|
|
- #{teacherId}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getHomeworkData" resultMap="com.ym.mec.biz.dal.dao.IndexBaseMonthDataDao.IndexBaseMonthData">
|
|
|
- SELECT
|
|
|
- sees.monday_ month_,
|
|
|
- <choose>
|
|
|
- <when test="type == 'submit'">
|
|
|
- SUM(sees.actual_exercises_num_) total_num_,
|
|
|
- SUM(sees.exercises_reply_num_) activate_num_,
|
|
|
- TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.actual_exercises_num_)*100, 2) percent_
|
|
|
- </when>
|
|
|
- <when test="type == 'comment'">
|
|
|
- SUM(sees.exercises_reply_num_) total_num_,
|
|
|
- SUM(sees.exercises_message_num_) activate_num_,
|
|
|
- TRUNCATE(SUM(sees.exercises_message_num_)/SUM(sees.exercises_reply_num_)*100, 2) percent_
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- SUM(sees.expect_exercises_num_-sees.not_over_course_num_) total_num_,
|
|
|
- SUM(sees.actual_exercises_num_) activate_num_,
|
|
|
- TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_-sees.not_over_course_num_)*100, 2) percent_
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- FROM student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN teacher tea ON sees.teacher_id_=tea.id_
|
|
|
- WHERE tea.job_nature_='FULL_TIME'
|
|
|
- AND DATE_FORMAT(sees.monday_, '%Y-%m-%d')>=#{startDay}
|
|
|
- AND DATE_FORMAT(sees.sunday_, '%Y-%m-%d')<=#{endDay}
|
|
|
- AND (sees.serve_type_ = 'EXERCISE' OR EXISTS (SELECT id_ FROM course_schedule WHERE group_type_='MUSIC' AND music_group_id_=#{musicGroupId} AND FIND_IN_SET(id_, sees.course_ids_)))
|
|
|
- AND sees.student_id_ IN
|
|
|
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
- #{studentId}
|
|
|
- </foreach>
|
|
|
- GROUP BY sees.monday_
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="queryCourseIdByClassDate" resultType="java.lang.Long">
|
|
|
- SELECT DISTINCT csts.course_schedule_id_ FROM course_schedule_teacher_salary csts
|
|
|
- LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
|
|
|
- LEFT JOIN student_extracurricular_exercises_situation_ se ON se.teacher_id_ = csts.user_id_
|
|
|
- WHERE csts.user_id_ = #{teacherId} AND cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
|
|
|
- AND FIND_IN_SET(cs.id_,se.course_ids_) AND se.serve_type_ = 'HOMEWORK'
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="countWaitCreateHomeworkNum" resultType="java.lang.Integer">
|
|
|
- SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE teacher_id_ = #{teacherId}
|
|
|
- AND expect_exercises_num_ > actual_exercises_num_ AND DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN monday_ AND sunday_
|
|
|
- AND serve_type_ = 'EXERCISE'
|
|
|
- </select>
|
|
|
- <select id="countWaitCreateHomeworkNum1" resultType="java.lang.Integer">
|
|
|
- SELECT SUM(t.num_) FROM (
|
|
|
- SELECT COUNT(se.id_) num_ FROM student_extracurricular_exercises_situation_ se
|
|
|
- LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_,se.course_ids_)
|
|
|
- WHERE se.teacher_id_ = #{teacherId}
|
|
|
- AND se.expect_exercises_num_ > se.actual_exercises_num_ AND DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN se.monday_ AND se.sunday_
|
|
|
- AND se.serve_type_ = 'HOMEWORK' AND cs.group_type_ = 'MUSIC' AND cs.class_date_ = DATE_FORMAT(NOW(), '%Y-%m-%d')
|
|
|
- UNION ALL
|
|
|
- SELECT COUNT(se.id_) num_ FROM student_extracurricular_exercises_situation_ se
|
|
|
- LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_,se.course_ids_)
|
|
|
- WHERE se.teacher_id_ = #{teacherId}
|
|
|
- AND se.expect_exercises_num_ > se.actual_exercises_num_ AND DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN se.monday_ AND se.sunday_
|
|
|
- AND se.serve_type_ = 'HOMEWORK' AND cs.group_type_ != 'MUSIC' AND cs.class_date_ <= DATE_FORMAT(NOW(), '%Y-%m-%d'))t
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="queryTeacherPerformanceIndicator" resultMap="TeacherServeDto">
|
|
|
- SELECT
|
|
|
- organ.name_ organ_name_,
|
|
|
- sees.monday_,
|
|
|
- sees.sunday_,
|
|
|
- sees.teacher_id_,
|
|
|
- su.real_name_ teacher_name_,
|
|
|
- tea.job_nature_,
|
|
|
- SUM(expect_exercises_num_) expect_exercises_num_,
|
|
|
- SUM(actual_exercises_num_) actual_exercises_num_,
|
|
|
- SUM(exercises_reply_num_) exercises_reply_num_,
|
|
|
- SUM(exercises_message_num_) exercises_message_num_,
|
|
|
- SUM(exercises_message_timely_num_) exercises_message_timely_num_,
|
|
|
- SUM(CASE sees.serve_type_ WHEN 'HOMEWORK' THEN sees.expect_exercises_num_ ELSE 0 END) homework_num_,
|
|
|
- SUM(CASE sees.serve_type_ WHEN 'EXERCISE' THEN 1 ELSE 0 END) exercise_num_,
|
|
|
- SUM( sees.expect_exercises_num_-sees.not_over_course_num_ )> SUM( sees.actual_exercises_num_ ) un_done_
|
|
|
- FROM
|
|
|
- student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
|
|
|
- LEFT JOIN organization organ ON organ.id_=tea.organ_id_
|
|
|
- LEFT JOIN sys_user su ON tea.id_=su.id_
|
|
|
- <include refid="queryTeacherServeInfoCondition" />
|
|
|
- GROUP BY sees.teacher_id_
|
|
|
- ORDER BY sees.teacher_id_
|
|
|
- <include refid="global.limit"></include>
|
|
|
- </select>
|
|
|
- <select id="getHomeworkSituations" resultType="java.util.Date">
|
|
|
- SELECT cs.class_date_ FROM student_extracurricular_exercises_situation_ sees
|
|
|
- LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_,sees.course_ids_)
|
|
|
- WHERE sees.serve_type_ = #{serveType} AND cs.id_ != #{courseScheduleId} AND cs.music_group_id_ = #{musicGroupId}
|
|
|
- AND sees.monday_ = #{month} AND sees.student_id_ = #{userId}
|
|
|
- </select>
|
|
|
+ SELECT *
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE teacher_id_ = #{teacherId}
|
|
|
+ AND actual_exercises_num_ <= 0
|
|
|
+ AND serve_type_ = 'HOMEWORK';
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getTeacherHomeworkCourseIdsWithMonday" resultType="string">
|
|
|
+ SELECT course_ids_ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE teacher_id_=#{teacherId}
|
|
|
+ AND serve_type_='HOMEWORK'
|
|
|
+ <if test="monday!=null and monday!=''">
|
|
|
+ AND monday_=#{monday}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findServiceWithCourse"
|
|
|
+ resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT *
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE monday_ = #{monday}
|
|
|
+ AND FIND_IN_SET(#{courseId}, course_ids_)
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="TeacherServeDto" type="com.ym.mec.biz.dal.dto.TeacherServeDto">
|
|
|
+ <result column="organ_name_" property="organName"/>
|
|
|
+ <result column="monday_" property="monday"/>
|
|
|
+ <result column="sunday_" property="sunday"/>
|
|
|
+ <result column="teacher_id_" property="teacherId"/>
|
|
|
+ <result column="teacher_name_" property="teacherName"/>
|
|
|
+ <result column="homework_num_" property="homeworkNum"/>
|
|
|
+ <result column="exercise_num_" property="exerciseNum"/>
|
|
|
+ <result column="un_done_" property="unDone"/>
|
|
|
+ <result column="remind_time_" property="remindDate"/>
|
|
|
+ <result column="operator_name_" property="operatorName"/>
|
|
|
+ <result column="job_nature_" property="jobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
|
+ <result column="expect_exercises_num_" property="expectExercisesNum"/>
|
|
|
+ <result column="actual_exercises_num_" property="actualExercisesNum"/>
|
|
|
+ <result column="exercises_reply_num_" property="exercisesReplyNum"/>
|
|
|
+ <result column="exercises_message_num_" property="exercisesMessageNum"/>
|
|
|
+ <result column="exercises_message_timely_num_" property="exercisesMessageTimelyNum"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+ <sql id="queryTeacherServeInfoCondition">
|
|
|
+ <where>
|
|
|
+ sees.tenant_id_ = #{tenantId}
|
|
|
+ <if test="organIds != null and organIds.size()>0">
|
|
|
+ AND tea.organ_id_ IN
|
|
|
+ <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
|
+ #{organId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="monday!=null and monday!='' and sunday!=null and sunday!=''">
|
|
|
+ AND sees.monday_ BETWEEN #{monday} AND #{sunday}
|
|
|
+ </if>
|
|
|
+ <if test="teacherId!=null">
|
|
|
+ AND sees.teacher_id_ = #{teacherId}
|
|
|
+ </if>
|
|
|
+ <if test="reminded!=null and reminded==0">
|
|
|
+ AND NOT EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ =
|
|
|
+ sees.monday_ AND type_='SERVICE')
|
|
|
+ </if>
|
|
|
+ <if test="reminded!=null and reminded==1">
|
|
|
+ AND EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_
|
|
|
+ AND type_='SERVICE')
|
|
|
+ </if>
|
|
|
+ <if test="operatorId!=null">
|
|
|
+ AND EXISTS (SELECT id_ FROM teacher_remind WHERE operator_id_=#{operatorId} AND
|
|
|
+ teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
|
|
|
+ </if>
|
|
|
+ <if test="jobNature!=null">
|
|
|
+ AND tea.job_nature_=#{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="queryTeacherServeInfo" resultMap="TeacherServeDto">
|
|
|
+ SELECT
|
|
|
+ organ.name_ organ_name_,
|
|
|
+ sees.monday_,
|
|
|
+ sees.sunday_,
|
|
|
+ sees.teacher_id_,
|
|
|
+ su.real_name_ teacher_name_,
|
|
|
+ tea.job_nature_,
|
|
|
+ SUM(expect_exercises_num_) expect_exercises_num_,
|
|
|
+ SUM(actual_exercises_num_) actual_exercises_num_,
|
|
|
+ SUM(exercises_reply_num_) exercises_reply_num_,
|
|
|
+ SUM(exercises_message_num_) exercises_message_num_,
|
|
|
+ SUM(exercises_message_timely_num_) exercises_message_timely_num_,
|
|
|
+ SUM(CASE sees.serve_type_ WHEN 'HOMEWORK' THEN sees.expect_exercises_num_ ELSE 0 END) homework_num_,
|
|
|
+ SUM(CASE sees.serve_type_ WHEN 'EXERCISE' THEN 1 ELSE 0 END) exercise_num_,
|
|
|
+ SUM( sees.expect_exercises_num_-sees.not_over_course_num_ )> SUM( sees.actual_exercises_num_ ) un_done_
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
|
|
|
+ LEFT JOIN organization organ ON organ.id_=tea.organ_id_
|
|
|
+ LEFT JOIN sys_user su ON tea.id_=su.id_
|
|
|
+ <include refid="queryTeacherServeInfoCondition"/>
|
|
|
+ GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
+ <trim prefix="HAVING" prefixOverrides="AND">
|
|
|
+ <if test="unDone!=null">
|
|
|
+ <if test="unDone==1">
|
|
|
+ AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) > SUM( sees.actual_exercises_num_
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="unDone==0">
|
|
|
+ AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) <= SUM(
|
|
|
+ sees.actual_exercises_num_ )
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
+ AND SUM(actual_exercises_num_) < SUM(expect_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
+ AND SUM(actual_exercises_num_) >= SUM(expect_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
+ AND SUM(exercises_reply_num_) < SUM(actual_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
+ AND SUM(exercises_reply_num_) >= SUM(actual_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
+ AND SUM(exercises_message_num_) < SUM(exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="serviceIsError!=null and serviceIsError">
|
|
|
+ AND (SUM(actual_exercises_num_) < SUM(expect_exercises_num_) OR SUM(exercises_message_num_) <
|
|
|
+ SUM(exercises_reply_num_))
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
+ AND SUM(exercises_message_num_) >= SUM(exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
+ AND SUM(exercises_message_timely_num_) < SUM(exercises_message_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
+ AND SUM(exercises_message_timely_num_) >= SUM(exercises_message_num_)
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
+ <include refid="global.limit"></include>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countTeacherServeInfo" resultType="int">
|
|
|
+ SELECT COUNT(1) FROM (
|
|
|
+ SELECT
|
|
|
+ sees.id_
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
|
|
|
+ <include refid="queryTeacherServeInfoCondition"/>
|
|
|
+ GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
+ <trim prefix="HAVING" prefixOverrides="AND">
|
|
|
+ <if test="unDone!=null">
|
|
|
+ <if test="unDone==1">
|
|
|
+ AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) > SUM( sees.actual_exercises_num_
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="unDone==0">
|
|
|
+ AND SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) <= SUM(
|
|
|
+ sees.actual_exercises_num_ )
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==0">
|
|
|
+ AND SUM(actual_exercises_num_) < SUM(expect_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNumIsAchieve!=null and actualExercisesNumIsAchieve==1">
|
|
|
+ AND SUM(actual_exercises_num_) >= SUM(expect_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==0">
|
|
|
+ AND SUM(exercises_reply_num_) < SUM(actual_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesReplyNumIsAchieve!=null and exercisesReplyNumIsAchieve==1">
|
|
|
+ AND SUM(exercises_reply_num_) >= SUM(actual_exercises_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==0">
|
|
|
+ AND SUM(exercises_message_num_) < SUM(exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="serviceIsError!=null and serviceIsError">
|
|
|
+ AND (SUM(actual_exercises_num_) < SUM(expect_exercises_num_) OR SUM(exercises_message_num_) <
|
|
|
+ SUM(exercises_reply_num_))
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNumIsAchieve!=null and exercisesMessageNumIsAchieve==1">
|
|
|
+ AND SUM(exercises_message_num_) >= SUM(exercises_reply_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==0">
|
|
|
+ AND SUM(exercises_message_timely_num_) < SUM(exercises_message_num_)
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNumIsAchieve!=null and exercisesMessageTimelyNumIsAchieve==1">
|
|
|
+ AND SUM(exercises_message_timely_num_) >= SUM(exercises_message_num_)
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
|
|
|
+ ) e
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findTeacherServeWithDate" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE monday_ BETWEEN #{monday} AND #{sunday}
|
|
|
+ <if test="serveType!=null and serveType!=''">
|
|
|
+ AND serve_type_=#{serveType}
|
|
|
+ </if>
|
|
|
+ AND teacher_id_ IN
|
|
|
+ <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
|
|
|
+ #{teacherId}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getHomeworkData" resultMap="com.ym.mec.biz.dal.dao.IndexBaseMonthDataDao.IndexBaseMonthData">
|
|
|
+ SELECT
|
|
|
+ sees.monday_ month_,
|
|
|
+ <choose>
|
|
|
+ <when test="type == 'submit'">
|
|
|
+ SUM(sees.actual_exercises_num_) total_num_,
|
|
|
+ SUM(sees.exercises_reply_num_) activate_num_,
|
|
|
+ TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.actual_exercises_num_)*100, 2) percent_
|
|
|
+ </when>
|
|
|
+ <when test="type == 'comment'">
|
|
|
+ SUM(sees.exercises_reply_num_) total_num_,
|
|
|
+ SUM(sees.exercises_message_num_) activate_num_,
|
|
|
+ TRUNCATE(SUM(sees.exercises_message_num_)/SUM(sees.exercises_reply_num_)*100, 2) percent_
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ SUM(sees.expect_exercises_num_-sees.not_over_course_num_) total_num_,
|
|
|
+ SUM(sees.actual_exercises_num_) activate_num_,
|
|
|
+ TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_-sees.not_over_course_num_)*100,
|
|
|
+ 2) percent_
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ FROM student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN teacher tea ON sees.teacher_id_=tea.id_
|
|
|
+ WHERE tea.job_nature_='FULL_TIME'
|
|
|
+ AND DATE_FORMAT(sees.monday_, '%Y-%m-%d')>=#{startDay}
|
|
|
+ AND DATE_FORMAT(sees.sunday_, '%Y-%m-%d')<=#{endDay}
|
|
|
+ AND (sees.serve_type_ = 'EXERCISE' OR EXISTS (SELECT id_ FROM course_schedule WHERE group_type_='MUSIC' AND
|
|
|
+ music_group_id_=#{musicGroupId} AND FIND_IN_SET(id_, sees.course_ids_)))
|
|
|
+ AND sees.student_id_ IN
|
|
|
+ <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
|
|
|
+ #{studentId}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY sees.monday_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryCourseIdByClassDate" resultType="java.lang.Long">
|
|
|
+ SELECT DISTINCT csts.course_schedule_id_
|
|
|
+ FROM course_schedule_teacher_salary csts
|
|
|
+ LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
|
|
|
+ LEFT JOIN student_extracurricular_exercises_situation_ se ON se.teacher_id_ = csts.user_id_
|
|
|
+ WHERE csts.user_id_ = #{teacherId}
|
|
|
+ AND cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
|
|
|
+ AND FIND_IN_SET(cs.id_, se.course_ids_)
|
|
|
+ AND se.serve_type_ = 'HOMEWORK'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countWaitCreateHomeworkNum" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(id_)
|
|
|
+ FROM student_extracurricular_exercises_situation_
|
|
|
+ WHERE teacher_id_ = #{teacherId}
|
|
|
+ AND expect_exercises_num_ > actual_exercises_num_
|
|
|
+ AND DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN monday_ AND sunday_
|
|
|
+ AND serve_type_ = 'EXERCISE'
|
|
|
+ </select>
|
|
|
+ <select id="countWaitCreateHomeworkNum1" resultType="java.lang.Integer">
|
|
|
+ SELECT SUM(t.num_)
|
|
|
+ FROM (
|
|
|
+ SELECT COUNT(se.id_) num_
|
|
|
+ FROM student_extracurricular_exercises_situation_ se
|
|
|
+ LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_, se.course_ids_)
|
|
|
+ WHERE se.teacher_id_ = #{teacherId}
|
|
|
+ AND se.expect_exercises_num_ > se.actual_exercises_num_
|
|
|
+ AND DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN se.monday_ AND se.sunday_
|
|
|
+ AND se.serve_type_ = 'HOMEWORK'
|
|
|
+ AND cs.group_type_ = 'MUSIC'
|
|
|
+ AND cs.class_date_ = DATE_FORMAT(NOW(), '%Y-%m-%d')
|
|
|
+ UNION ALL
|
|
|
+ SELECT COUNT(se.id_) num_
|
|
|
+ FROM student_extracurricular_exercises_situation_ se
|
|
|
+ LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_, se.course_ids_)
|
|
|
+ WHERE se.teacher_id_ = #{teacherId}
|
|
|
+ AND se.expect_exercises_num_ > se.actual_exercises_num_
|
|
|
+ AND DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN se.monday_ AND se.sunday_
|
|
|
+ AND se.serve_type_ = 'HOMEWORK'
|
|
|
+ AND cs.group_type_ != 'MUSIC' AND cs.class_date_ <= DATE_FORMAT(NOW(), '%Y-%m-%d')) t
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryTeacherPerformanceIndicator" resultMap="TeacherServeDto">
|
|
|
+ SELECT
|
|
|
+ organ.name_ organ_name_,
|
|
|
+ sees.monday_,
|
|
|
+ sees.sunday_,
|
|
|
+ sees.teacher_id_,
|
|
|
+ su.real_name_ teacher_name_,
|
|
|
+ tea.job_nature_,
|
|
|
+ SUM(expect_exercises_num_) expect_exercises_num_,
|
|
|
+ SUM(actual_exercises_num_) actual_exercises_num_,
|
|
|
+ SUM(exercises_reply_num_) exercises_reply_num_,
|
|
|
+ SUM(exercises_message_num_) exercises_message_num_,
|
|
|
+ SUM(exercises_message_timely_num_) exercises_message_timely_num_,
|
|
|
+ SUM(CASE sees.serve_type_ WHEN 'HOMEWORK' THEN sees.expect_exercises_num_ ELSE 0 END) homework_num_,
|
|
|
+ SUM(CASE sees.serve_type_ WHEN 'EXERCISE' THEN 1 ELSE 0 END) exercise_num_,
|
|
|
+ SUM( sees.expect_exercises_num_-sees.not_over_course_num_ )> SUM( sees.actual_exercises_num_ ) un_done_
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
|
|
|
+ LEFT JOIN organization organ ON organ.id_=tea.organ_id_
|
|
|
+ LEFT JOIN sys_user su ON tea.id_=su.id_
|
|
|
+ <include refid="queryTeacherServeInfoCondition"/>
|
|
|
+ GROUP BY sees.teacher_id_
|
|
|
+ ORDER BY sees.teacher_id_
|
|
|
+ <include refid="global.limit"></include>
|
|
|
+ </select>
|
|
|
+ <select id="getHomeworkSituations" resultType="java.util.Date">
|
|
|
+ SELECT cs.class_date_
|
|
|
+ FROM student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_, sees.course_ids_)
|
|
|
+ WHERE sees.serve_type_ = #{serveType}
|
|
|
+ AND cs.id_ != #{courseScheduleId}
|
|
|
+ AND cs.music_group_id_ = #{musicGroupId}
|
|
|
+ AND sees.monday_ = #{month}
|
|
|
+ AND sees.student_id_ = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="StudentServeDto" type="com.ym.mec.biz.dal.dto.StudentServeDto">
|
|
|
+ <result column="student_id_" property="userId"/>
|
|
|
+ <result column="username_" property="username"/>
|
|
|
+ <result column="music_group_name_" property="musicGroupName"/>
|
|
|
+ <result column="organ_name_" property="organName"/>
|
|
|
+ <result column="serve_period_" property="servePeriod"/>
|
|
|
+ <result column="serve_num_" property="serveNum"/>
|
|
|
+ <result column="actual_exercises_num_" property="actualExercisesNum"/>
|
|
|
+ <result column="exercises_reply_num_" property="exercisesReplyNum"/>
|
|
|
+ <result column="exercises_message_num_" property="exercisesMessageNum"/>
|
|
|
+ <result column="sign_rate_" property="signRate"/>
|
|
|
+ <result column="pass_rate_" property="passRate"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 还差出勤率和达标率 -->
|
|
|
+ <select id="queryStudentServeInfo" resultMap="StudentServeDto">
|
|
|
+ select
|
|
|
+ t.student_id_,
|
|
|
+ t.music_group_name_,
|
|
|
+ concat(#{params.startTime},'至', #{params.endTime}) as serve_period_,
|
|
|
+ t.username_,
|
|
|
+ t.organ_name_,
|
|
|
+ ifnull(sees.serve_num_,0) as serve_num_,
|
|
|
+ ifnull(sees.actual_exercises_num_,0) as actual_exercises_num_,
|
|
|
+ ifnull(sees.exercises_reply_num_,0) as exercises_reply_num_,
|
|
|
+ ifnull(sees.exercises_message_num_,0) as exercises_message_num_,
|
|
|
+ round(ifnull(a.sign_rate_,0) * 100,2) as sign_rate_,
|
|
|
+ round(ifnull(a.pass_rate_,0) * 100,2) as pass_rate_
|
|
|
+ from (
|
|
|
+ select
|
|
|
+ a.user_id_ as student_id_,
|
|
|
+ group_concat(distinct b.name_) as music_group_name_,
|
|
|
+ u.username_,
|
|
|
+ organ.name_ as organ_name_
|
|
|
+ from student_registration a
|
|
|
+ left join music_group b on a.music_group_id_ = b.id_
|
|
|
+ left join sys_user u ON a.user_id_ = u.id_
|
|
|
+ LEFT JOIN organization organ ON organ.id_=u.organ_id_ and organ.del_flag_ = 0
|
|
|
+ where payment_status_ = 2 and b.status_ = 'PROGRESS'
|
|
|
+ <if test="params.tenantId != null and params.tenantId > 0">
|
|
|
+ AND a.tenant_id_ = #{params.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="params.organId != null and params.organId != ''">
|
|
|
+ AND FIND_IN_SET(u.organ_id_,#{params.organId})
|
|
|
+ </if>
|
|
|
+ group by a.user_id_
|
|
|
+ ) t
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ select
|
|
|
+ sees.student_id_,
|
|
|
+ sum(sees.expect_exercises_num_) as serve_num_,
|
|
|
+ sum(sees.actual_exercises_num_) as actual_exercises_num_,
|
|
|
+ sum(sees.exercises_reply_num_) as exercises_reply_num_,
|
|
|
+ sum(sees.exercises_message_num_) as exercises_message_num_
|
|
|
+ from student_extracurricular_exercises_situation_ sees
|
|
|
+ left join sys_user u ON sees.student_id_ = u.id_
|
|
|
+ <where>
|
|
|
+ <if test="params.tenantId != null and params.tenantId > 0">
|
|
|
+ AND sees.tenant_id_ = #{params.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="params.startTime != null and params.startTime != ''">
|
|
|
+ AND DATE_FORMAT(sees.monday_, '%Y-%m-%d') >= #{params.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="params.endTime != null and params.endTime != ''">
|
|
|
+ AND DATE_FORMAT(sees.sunday_, '%Y-%m-%d') <= #{params.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="params.organId != null and params.organId != ''">
|
|
|
+ AND FIND_IN_SET(u.organ_id_,#{params.organId})
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by sees.student_id_
|
|
|
+ ) sees on t.student_id_ = sees.student_id_
|
|
|
+ left join (
|
|
|
+ select
|
|
|
+ cssp.user_id_,
|
|
|
+ ifnull(sum(if(sa.status_ in ('NORMAL','LATE'),1,0))/count(cs.id_),0) as sign_rate_,
|
|
|
+ ifnull(sum(sa.qualified_flag_)/count(cs.id_),0) as pass_rate_
|
|
|
+ from course_schedule cs
|
|
|
+ left join course_schedule_student_payment cssp on cs.id_ = cssp.course_schedule_id_
|
|
|
+ left join sys_user u ON cssp.user_id_ = u.id_
|
|
|
+ left join student_attendance sa on cssp.user_id_ = sa.user_id_ and cs.id_ = sa.course_schedule_id_
|
|
|
+ <where>
|
|
|
+ cs.del_flag_ = 0 and cs.is_lock_ = 0 AND cs.pre_course_flag_ = 0 AND cs.organ_id_ IS NOT NULL and cs.id_ is not null
|
|
|
+ and cs.group_type_ = 'MUSIC'
|
|
|
+ and (cs.new_course_id_ is null or cs.id_ = cs.new_course_id_)
|
|
|
+ <if test="params.tenantId != null and params.tenantId > 0">
|
|
|
+ AND cs.tenant_id_ = #{params.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="params.startTime != null and params.startTime != ''">
|
|
|
+ AND DATE_FORMAT(cs.class_date_, '%Y-%m-%d') >= #{params.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="params.endTime != null and params.endTime != ''">
|
|
|
+ AND DATE_FORMAT(cs.class_date_, '%Y-%m-%d') <= #{params.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="params.organId != null and params.organId != ''">
|
|
|
+ AND FIND_IN_SET(u.organ_id_,#{params.organId})
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by cssp.user_id_
|
|
|
+ ) a on sees.student_id_ = a.user_id_
|
|
|
+ </select>
|
|
|
</mapper>
|