优化sql

beetlsql3-dev
Mlxa0324 2 years ago
parent a5bf094e42
commit b2cbde352e

@ -114,17 +114,13 @@ public class TeacherOpenCourseStudentSigninSetting extends BaseEntity{
private Integer signinTotalCount;
// 学生总人数
@FetchSql("select count(1) from student t where find_in_set(t.class_id, #schoolClassIdsIfAll#) ")
@FetchSql("select count(1) from student t where find_in_set(t.class_id, #schoolClassIdsRender#) ")
private Integer signinStudentTotalCount;
// 缺勤 schoolClassIds
@FetchSql("select if((count(tc.student_id) - #signinTotalCount#) < 0, 0, count(tc.student_id) - #signinTotalCount#) " +
"from teacher_open_course_student_signin_log t " +
"left join teacher_open_course_student_signin_setting ta on ta.teacher_open_course_student_signin_setting_id = t.teacher_open_course_student_signin_setting_id " +
"left join school_class tb on find_in_set(tb.class_id, ta.school_class_ids) " +
"left join student tc on tc.class_id = tb.class_id " +
"where t.teacher_open_course_id = #teacherOpenCourseId# ")
@FetchSql("select if((#signinStudentTotalCount# - #signinTotalCount#) < 0, 0, (#signinStudentTotalCount# - #signinTotalCount#))")
private Integer unsigninCount;
// 合计到课率 100为单位

Loading…
Cancel
Save