yonge 4 lat temu
rodzic
commit
7503464346

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentAttendanceQueryInfo.java

@@ -2,6 +2,9 @@ package com.ym.mec.biz.dal.page;
 
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.Date;
+
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.common.page.QueryInfo;
 
@@ -34,9 +37,18 @@ public class StudentAttendanceQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "状态(正常、旷课、请假、休学)",required = false)
     private StudentAttendanceStatusEnum status;
+    
+    @ApiModelProperty(value = "课程状态")
+    private CourseStatusEnum courseStatus;
 
     @ApiModelProperty(value = "过滤状态")
     private StudentAttendanceStatusEnum filterStatus;
+    
+    @ApiModelProperty(value = "课程开始时间")
+    private Date startDateOfCourse;
+    
+    @ApiModelProperty(value = "课程结束时间")
+    private Date endDateOfCourse;
 
     public Long getCourseScheduleId() {
         return courseScheduleId;
@@ -109,4 +121,28 @@ public class StudentAttendanceQueryInfo extends QueryInfo {
     public void setStatus(StudentAttendanceStatusEnum status) {
         this.status = status;
     }
+
+	public CourseStatusEnum getCourseStatus() {
+		return courseStatus;
+	}
+
+	public void setCourseStatus(CourseStatusEnum courseStatus) {
+		this.courseStatus = courseStatus;
+	}
+
+	public Date getStartDateOfCourse() {
+		return startDateOfCourse;
+	}
+
+	public void setStartDateOfCourse(Date startDateOfCourse) {
+		this.startDateOfCourse = startDateOfCourse;
+	}
+
+	public Date getEndDateOfCourse() {
+		return endDateOfCourse;
+	}
+
+	public void setEndDateOfCourse(Date endDateOfCourse) {
+		this.endDateOfCourse = endDateOfCourse;
+	}
 }

+ 43 - 18
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -31,6 +31,7 @@
         <result column="teacher_name_" property="courseSchedule.teacherName"/>
         <result column="teach_mode_" property="courseSchedule.teachMode"/>
         <result column="course_type_" property="courseSchedule.type"/>
+        <result column="course_status_" property="courseSchedule.status"/>
         <result column="current_schedule_id_" property="courseSchedule.id"/>
         <result column="course_schedule_name_" property="courseSchedule.name"/>
         <result column="class_date_" property="courseSchedule.classDate"/>
@@ -483,66 +484,90 @@
     </select>
     
     <select id="findStudentAttendance" resultMap="StudentAttendance">
-        SELECT sa.*,su.username_,su.phone_,su.avatar_,cs.teach_mode_,cs.type_ course_type_,o.name_ organ_name_,tu.real_name_ teacher_name_,cs.name_ course_schedule_name_,
-        cs.class_date_ ,cs.start_class_time_,cs.end_class_time_ 
-        FROM student_attendance sa
-        LEFT JOIN sys_user su ON sa.user_id_ = su.id_
-        left join course_schedule cs on cs.id_ = sa.course_schedule_id_
+        SELECT cssp.course_schedule_id_,cssp.user_id_,cssp.group_type_,cssp.music_group_id_,sa.sign_in_time_,sa.sign_out_time_,sa.status_,
+        su.username_,su.phone_,su.avatar_,cs.teach_mode_,cs.type_ course_type_,o.name_ organ_name_,tu.real_name_ teacher_name_,cs.name_ course_schedule_name_,cs.status_ course_status_,
+        cs.actual_teacher_id_ teacher_id_,cs.class_date_ ,cs.start_class_time_,cs.end_class_time_ 
+        FROM course_schedule_student_payment cssp left join course_schedule cs on cs.id_ = cssp.course_schedule_id_
+        left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_
+        LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
         left join sys_user tu on tu.id_ = cs.actual_teacher_id_
         left join organization o on o.id_ = cs.organ_id_
         <where>
         	<if test="courseScheduleId != null">
-        		sa.course_schedule_id_ = #{courseScheduleId}
+        		cssp.course_schedule_id_ = #{courseScheduleId}
         	</if>
         	<if test="search != null">
-        		sa.course_schedule_id_ = #{search}
+        		cssp.course_schedule_id_ = #{search}
         	</if>
         	<if test="studentID != null">
-        		and sa.user_id_ = #{studentID}
+        		and cssp.user_id_ = #{studentID}
+        	</if>
+        	<if test="startDateOfCourse != null">
+        		and cs.class_date_ &gt;= #{startDateOfCourse}
+        	</if>
+        	<if test="endDateOfCourse != null">
+        		and cs.class_date_ &lt;= #{endDateOfCourse}
         	</if>
         	<if test="courseScheduleType != null">
         		and cs.type_ = #{courseScheduleType}
         	</if>
         	<if test="teacherId != null">
-        		and sa.teacher_id_ = #{teacherId}
+        		and cs.actual_teacher_id_.teacher_id_ = #{teacherId}
+        	</if>
+        	<if test="courseStatus != null">
+        		and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         	</if>
         	<if test="status != null">
         		and sa.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         	</if>
         	<if test="groupType != null">
-        		and sa.group_type_ = #{groupType}
+        		and cssp.group_type_ = #{groupType}
         	</if>
         	<if test="musicGroupId != null">
-        		and sa.music_group_id_ = #{musicGroupId}
+        		and cssp.music_group_id_ = #{musicGroupId}
         	</if>
         </where>
-        ORDER BY sa.id_ DESC
+        ORDER BY cs.id_ DESC
         <include refid="global.limit"/>
     </select>
     
     <select id="countStudentAttendance" resultType="java.lang.Integer">
-        SELECT COUNT(sa.id_) FROM student_attendance sa left join course_schedule cs on sa.course_schedule_id_ = cs.id_
+        SELECT count(cssp.id_) 
+        FROM course_schedule_student_payment cssp left join course_schedule cs on cs.id_ = cssp.course_schedule_id_
+        left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_
         <where>
         	<if test="courseScheduleId != null">
-        		sa.course_schedule_id_ = #{courseScheduleId}
+        		cssp.course_schedule_id_ = #{courseScheduleId}
+        	</if>
+        	<if test="search != null">
+        		cssp.course_schedule_id_ = #{search}
         	</if>
         	<if test="studentID != null">
-        		and sa.user_id_ = #{studentID}
+        		and cssp.user_id_ = #{studentID}
+        	</if>
+        	<if test="startDateOfCourse != null">
+        		and cs.class_date_ &gt;= #{startDateOfCourse}
+        	</if>
+        	<if test="endDateOfCourse != null">
+        		and cs.class_date_ &lt;= #{endDateOfCourse}
         	</if>
         	<if test="courseScheduleType != null">
         		and cs.type_ = #{courseScheduleType}
         	</if>
         	<if test="teacherId != null">
-        		and sa.teacher_id_ = #{teacherId}
+        		and cs.actual_teacher_id_.teacher_id_ = #{teacherId}
+        	</if>
+        	<if test="courseStatus != null">
+        		and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         	</if>
         	<if test="status != null">
         		and sa.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         	</if>
         	<if test="groupType != null">
-        		and sa.group_type_ = #{groupType}
+        		and cssp.group_type_ = #{groupType}
         	</if>
         	<if test="musicGroupId != null">
-        		and sa.music_group_id_ = #{musicGroupId}
+        		and cssp.music_group_id_ = #{musicGroupId}
         	</if>
         </where>
     </select>