SELECT COUNT(id) as zrs,(SELECT COUNT(id) FROM curricula_student WHERE curricula_id = #{curriculaId} and curricula_state = '2' AND del_flag = '0') as yxrs FROM curricula_student WHERE curricula_id = #{curriculaId} AND del_flag = '0'
SELECT COUNT(id) as zrs,(SELECT COUNT(id) FROM curricula_student WHERE curricula_id = #{curriculaId} and curricula_state = '2' AND del_flag = '0') as yxrs FROM curricula_student WHERE curricula_id = #{curriculaId} AND del_flag = '0'
</select>
<!--选课情况列表-->
...
...
@@ -53,6 +54,7 @@
<iftest="courseType != null and courseType != ''">and xk.course_type = #{courseType}</if>
<iftest="curriculaState != null and curriculaState != ''">and xk.curricula_state = #{curriculaState}</if>
<iftest="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
group by xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject,dc.division_classes_name
<iftest="selectedMajor != null and selectedMajor != ''">and xk.selected_major like concat('%', #{selectedMajor}, '%')</if>
<iftest="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
group by xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject,dc.division_classes_name
<iftest="selectedCourse != null and selectedCourse != ''">and xk.selected_course = #{selectedCourse}</if>
<iftest="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
group by xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
<iftest="selectedCourse != null and selectedCourse != ''">and xk.selected_course = #{selectedCourse}</if>
<iftest="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
GROUP BY xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
<iftest="selectedSubject != null and selectedSubject != ''">and xk.selected_subject = #{selectedSubject}</if>
<iftest="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
GROUP BY xk.id,xk.student_id,xk.curricula_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject,dc.division_classes_name
LEFT JOIN school_student xs ON xk.student_id = xs.id
LEFT JOIN school_class bj ON xs.class_id = bj.id
LEFT JOIN school_division_student ds ON xk.student_id = ds.student_id
LEFT JOIN school_division_classes dc ON ds.division_classes_id = dc.id
WHERE
xk.curricula_id = #{curriculaId} AND xk.del_flag = '0' AND xs.class_id IN (SELECT class_id FROM school_class_headmaster WHERE teacher_id = #{teacherId})
<iftest="courseType != null and courseType != ''">and xk.course_type = #{courseType}</if>
<iftest="classId != null and classId != ''">and xs.class_id = #{classId}</if>
<iftest="curriculaState != null and curriculaState != ''">and xk.curricula_state = #{curriculaState}</if>
<iftest="studentName != null and studentName != ''">and xs.student_name like concat('%', #{studentName}, '%')</if>
GROUP BY xk.id,xk.student_id,xk.curricula_id,xs.class_id,bj.class_name,xs.student_name,xs.id_card,xs.school_no,xk.course_type,xk.curricula_time,xk.curricula_state,xk.selected_course,xk.selected_major,xk.selected_subject
SELECT id as classId,class_name as className FROM school_class WHERE grade_id = (SELECT id FROM school_grade where grade_year = #{grade} AND del_flag = '0')
</select>
<selectid="getGrade"resultType="Map">
select
cv.id as curriculaId,
cv.task_name as curriculaName,
cv.grade as grade,
(SELECT COUNT(id) as yxrs FROM curricula_student WHERE curricula_id = cv.id and curricula_state = '2' AND del_flag = '0') as yxrs,
(SELECT COUNT(id) as zrs FROM curricula_student WHERE curricula_id = cv.id AND del_flag = '0') as zrs