|
@@ -917,29 +917,46 @@
|
|
|
<!-- 还差出勤率和达标率 -->
|
|
|
<select id="queryStudentServeInfo" resultMap="StudentServeDto">
|
|
|
select
|
|
|
- sees.student_id_,
|
|
|
- sees.username_,
|
|
|
- sees.organ_name_,
|
|
|
+ t.student_id_,
|
|
|
+ t.music_group_name_,
|
|
|
+ concat(#{params.monday},'至', #{params.sunday}) as serve_period_,
|
|
|
+ t.username_,
|
|
|
+ t.organ_name_,
|
|
|
sees.serve_num_,
|
|
|
sees.actual_exercises_num_,
|
|
|
sees.exercises_reply_num_,
|
|
|
sees.exercises_message_num_,
|
|
|
a.sign_rate_,
|
|
|
- a.pass_rate_,
|
|
|
- b.music_group_name_,
|
|
|
- concat(#{params.monday},'至', #{params.sunday}) as serve_period_
|
|
|
+ a.pass_rate_
|
|
|
from (
|
|
|
select
|
|
|
- sees.student_id_,
|
|
|
+ a.user_id_ as student_id_,
|
|
|
+ group_concat(distinct b.name_) as music_group_name_,
|
|
|
u.username_,
|
|
|
- organ.name_ as organ_name_,
|
|
|
- count(sees.id_) as serve_num_,
|
|
|
+ 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_ = 1 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_
|
|
|
- LEFT JOIN organization organ ON organ.id_=u.organ_id_ and organ.del_flag_ = 0
|
|
|
<where>
|
|
|
<if test="params.tenantId != null and params.tenantId > 0">
|
|
|
AND sees.tenant_id_ = #{params.tenantId}
|
|
@@ -955,42 +972,32 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
group by sees.student_id_
|
|
|
- ) sees
|
|
|
+ ) sees on t.student_id_ = sees.student_id_
|
|
|
left join (
|
|
|
select
|
|
|
- sees.student_id_,
|
|
|
+ cssp.user_id_,
|
|
|
ifnull(sum(if(sa.status_ = 'NORMAL',1,0))/count(sa.id_),0) as sign_rate_,
|
|
|
ifnull(sum(sa.qualified_flag_)/count(sa.id_),0) as pass_rate_
|
|
|
- from student_extracurricular_exercises_situation_ sees
|
|
|
- left join sys_user u ON sees.student_id_ = u.id_
|
|
|
- left join course_schedule cs on find_in_set(cs.id_,sees.course_ids_) and cs.del_flag_ = 0
|
|
|
- left join music_group mg on cs.music_group_id_ = mg.id_
|
|
|
- left join student_attendance sa on sees.student_id_ = sa.user_id_ and cs.id_ = sa.course_schedule_id_
|
|
|
+ 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.id_ is not null
|
|
|
+ cs.group_type_ = 'MUSIC' and cs.id_ is not null
|
|
|
<if test="params.tenantId != null and params.tenantId > 0">
|
|
|
- AND sees.tenant_id_ = #{params.tenantId}
|
|
|
+ AND cs.tenant_id_ = #{params.tenantId}
|
|
|
</if>
|
|
|
<if test="params.monday != null and params.monday != ''">
|
|
|
- AND DATE_FORMAT(sees.monday_, '%Y-%m-%d') >= #{params.monday}
|
|
|
+ AND DATE_FORMAT(cs.start_class_time_, '%Y-%m-%d') >= #{params.monday}
|
|
|
</if>
|
|
|
<if test="params.sunday != null and params.sunday != ''">
|
|
|
- AND DATE_FORMAT(sees.sunday_, '%Y-%m-%d') <= #{params.sunday}
|
|
|
+ AND DATE_FORMAT(cs.end_class_time_, '%Y-%m-%d') <= #{params.sunday}
|
|
|
</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_
|
|
|
- ) a on sees.student_id_ = a.student_id_
|
|
|
- left join (
|
|
|
- select
|
|
|
- user_id_,group_concat(distinct b.name_) as music_group_name_
|
|
|
- from student_registration a
|
|
|
- left join music_group b on a.music_group_id_ = b.id_
|
|
|
- where payment_status_ = 1 and music_group_status_ = 'PROGRESS'
|
|
|
- group by a.user_id_
|
|
|
- ) b on sees.student_id_ = b.user_id_
|
|
|
+ group by cssp.user_id_
|
|
|
+ ) a on sees.student_id_ = a.user_id_
|
|
|
</select>
|
|
|
-
|
|
|
</mapper>
|