Browse Source

Merge branch 'master' of https://gitee.com/zouxuan/mec

zouxuan 5 years ago
parent
commit
0472c552f3

+ 12 - 11
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -1,15 +1,14 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.web.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.web.service.CourseScheduleService;
+import com.ym.mec.web.service.StudentAttendanceService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.client.RestTemplate;
 
 /**
@@ -24,18 +23,20 @@ public class CourseScheduleController extends BaseController {
     @Autowired
     private CourseScheduleService scheduleService;
     @Autowired
+    private StudentAttendanceService studentAttendanceService;
+    @Autowired
     private RestTemplate restTemplate;
 
-    @ApiOperation(value = "查询正在或即将开始的课程")
-    @GetMapping("/getCurrentCourseDetail")
-    public Object getCurrentCourseDetail(){
-        return succeed(scheduleService.getCurrentCourseDetail(1));
+    @ApiOperation(value = "根据课程ID查询正在或即将开始的课程")
+    @GetMapping("/getCurrentCourseDetail/{courseID}")
+    public Object getCurrentCourseDetail(@ApiParam(value = "课程ID", required = true) @PathVariable("courseID") Long courseID){
+        return succeed(scheduleService.getCurrentCourseDetail(courseID));
     }
 
     @ApiOperation(value = "根据班级ID获取当前课程的学生")
-    @GetMapping("/getCurrentCourseStudents/{classID}")
-    public Object getCurrentCourseStudents(@ApiParam(value = "学校编号", required = true) @PathVariable("classID") Long classID){
-        return succeed(scheduleService.getCurrentCourseStudents(classID));
+    @GetMapping("/getCurrentCourseStudents")
+    public Object getCurrentCourseStudents(@RequestBody StudentAttendanceQueryInfo queryInfo){
+        return succeed(studentAttendanceService.queryPage(queryInfo));
     }
 
 }

+ 2 - 13
mec-web/src/main/java/com/ym/mec/web/dal/dao/CourseScheduleDao.java

@@ -1,13 +1,10 @@
 package com.ym.mec.web.dal.dao;
 
 import com.ym.mec.common.dal.BaseDAO;
-import com.ym.mec.web.dal.entity.CourseSchedule;
-import com.ym.mec.web.dal.dto.StudentAttendanceViewDto;
 import com.ym.mec.web.dal.dto.TeacherAttendanceDto;
+import com.ym.mec.web.dal.entity.CourseSchedule;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
-
 public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     /**
@@ -15,13 +12,5 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param teacherID
      * @return
      */
-    TeacherAttendanceDto getCurrentCourseDetail(@Param("teacherID") Integer teacherID);
-
-    /**
-     * 根据班级ID获取该班级学生
-     * @param classID
-     * @return
-     */
-    List<StudentAttendanceViewDto> getCurrentCourseStudents(@Param("classID") Long classID);
-
+    TeacherAttendanceDto getCurrentCourseDetail(@Param("teacherID") Long teacherID);
 }

+ 16 - 1
mec-web/src/main/java/com/ym/mec/web/dal/dao/StudentAttendanceDao.java

@@ -2,6 +2,8 @@ package com.ym.mec.web.dal.dao;
 
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.web.dal.entity.StudentAttendance;
+import com.ym.mec.web.dal.utilEntity.StudentStatusCountUtilEntity;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -13,5 +15,18 @@ public interface StudentAttendanceDao extends BaseDAO<Long, StudentAttendance> {
      * 批量插入学生上课签到情况
      */
     int addStudentAttendances(List<StudentAttendance> studentAttendances);
-	
+
+    /**
+     * 统计学生各种状态人数
+     * @param classId
+     * @return
+     */
+    List<StudentStatusCountUtilEntity> countStudentStatus(@Param("classId") Long classId);
+
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/9/12
+     * 获取学生签到所需信息
+     */
+    StudentAttendance getStudentAttendanceInfo(StudentAttendance studentAttendance);
 }

+ 22 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dto/StudentAttendancePageInfo.java

@@ -0,0 +1,22 @@
+package com.ym.mec.web.dal.utilEntity;
+
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/12
+ */
+public class StudentAttendancePageInfo extends PageInfo {
+
+    @ApiModelProperty(value = "请假人数",required = false)
+    private Integer numberOfLeavePeoples;
+
+    public Integer getNumberOfLeavePeoples() {
+        return numberOfLeavePeoples;
+    }
+
+    public void setNumberOfLeavePeoples(Integer numberOfLeavePeoples) {
+        this.numberOfLeavePeoples = numberOfLeavePeoples;
+    }
+}

+ 33 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dto/StudentStatusCountUtilEntity.java

@@ -0,0 +1,33 @@
+package com.ym.mec.web.dal.utilEntity;
+
+import com.ym.mec.web.dal.enums.StudentAttendanceStatusEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/12
+ */
+public class StudentStatusCountUtilEntity {
+
+    @ApiModelProperty(value = "状态(正常、旷课、请假、休学)",required = false)
+    private StudentAttendanceStatusEnum studentStatus;
+
+    @ApiModelProperty(value = "人数",required = false)
+    private Integer numberOfStudent;
+
+    public StudentAttendanceStatusEnum getStudentStatus() {
+        return studentStatus;
+    }
+
+    public void setStudentStatus(StudentAttendanceStatusEnum studentStatus) {
+        this.studentStatus = studentStatus;
+    }
+
+    public Integer getNumberOfStudent() {
+        return numberOfStudent;
+    }
+
+    public void setNumberOfStudent(Integer numberOfStudent) {
+        this.numberOfStudent = numberOfStudent;
+    }
+}

+ 34 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dto/TeacherAttendanceDto.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.dal.dto;
 
 import com.ym.mec.web.dal.enums.CourseStatusEnum;
+import com.ym.mec.web.dal.enums.ParamEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.Date;
@@ -32,6 +33,9 @@ public class TeacherAttendanceDto {
     @ApiModelProperty(value = "班级类型",required = false)
     private String classType;
 
+    @ApiModelProperty(value = "科目ID",required = false)
+    private Long subjectId;
+
     @ApiModelProperty(value = "乐团ID",required = false)
     private Long musicGroupId;
 
@@ -51,6 +55,36 @@ public class TeacherAttendanceDto {
     @ApiModelProperty(value = "课程状态  NOT_START未开始,SIGN_IN已签到,SIGN_OUT已签退",required = false)
     private CourseStatusEnum courseStatus;
 
+    @ApiModelProperty(value = "服务器当前时间",required = false)
+    private Date currentTime;
+
+    @ApiModelProperty(value = "教师正常签到提前时间(分钟)",required = false)
+    private ParamEnum teacherAttendanceTimeGap;
+
+    public Long getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Long subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public ParamEnum getTeacherAttendanceTimeGap() {
+        return teacherAttendanceTimeGap;
+    }
+
+    public void setTeacherAttendanceTimeGap(ParamEnum teacherAttendanceTimeGap) {
+        this.teacherAttendanceTimeGap = teacherAttendanceTimeGap;
+    }
+
+    public Date getCurrentTime() {
+        return currentTime;
+    }
+
+    public void setCurrentTime(Date currentTime) {
+        this.currentTime = currentTime;
+    }
+
     public CourseStatusEnum getCourseStatus() {
         return courseStatus;
     }

+ 53 - 51
mec-web/src/main/java/com/ym/mec/web/dal/entity/TeacherAttendance.java

@@ -4,6 +4,8 @@ import com.ym.mec.web.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import java.util.Date;
+
 /**
  * 对应数据库表(teacher_attendance):
  */
@@ -14,19 +16,19 @@ public class TeacherAttendance {
 	
 	/**  */
 	@ApiModelProperty(value = "教师编号",required = false)
-	private Integer teacherId;
+	private Long teacherId;
 	
 	/**  */
 	@ApiModelProperty(value = "乐团编号",required = false)
-	private Integer musicGroupId;
+	private Long musicGroupId;
 	
 	/**  */
 	@ApiModelProperty(value = "科目编号",required = false)
-	private Integer subjectId;
+	private Long subjectId;
 	
 	/**  */
 	@ApiModelProperty(value = "班级编号",required = false)
-	private Integer classGroupId;
+	private Long classGroupId;
 	
 	/**  */
 	@ApiModelProperty(value = "课程计划编号",required = false)
@@ -46,62 +48,62 @@ public class TeacherAttendance {
 	
 	/**  */
 	private java.util.Date createTime;
-	
-	public void setId(Long id){
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
 		this.id = id;
 	}
-	
-	public Long getId(){
-		return this.id;
+
+	public Long getTeacherId() {
+		return teacherId;
 	}
-			
-	public void setTeacherId(Integer teacherId){
+
+	public void setTeacherId(Long teacherId) {
 		this.teacherId = teacherId;
 	}
-	
-	public Integer getTeacherId(){
-		return this.teacherId;
+
+	public Long getMusicGroupId() {
+		return musicGroupId;
 	}
-			
-	public void setMusicGroupId(Integer musicGroupId){
+
+	public void setMusicGroupId(Long musicGroupId) {
 		this.musicGroupId = musicGroupId;
 	}
-	
-	public Integer getMusicGroupId(){
-		return this.musicGroupId;
+
+	public Long getSubjectId() {
+		return subjectId;
 	}
-			
-	public void setSubjectId(Integer subjectId){
+
+	public void setSubjectId(Long subjectId) {
 		this.subjectId = subjectId;
 	}
-	
-	public Integer getSubjectId(){
-		return this.subjectId;
+
+	public Long getClassGroupId() {
+		return classGroupId;
 	}
-			
-	public void setClassGroupId(Integer classGroupId){
+
+	public void setClassGroupId(Long classGroupId) {
 		this.classGroupId = classGroupId;
 	}
-	
-	public Integer getClassGroupId(){
-		return this.classGroupId;
+
+	public Long getCourseScheduleId() {
+		return courseScheduleId;
 	}
-			
-	public void setCourseScheduleId(Long courseScheduleId){
+
+	public void setCourseScheduleId(Long courseScheduleId) {
 		this.courseScheduleId = courseScheduleId;
 	}
-	
-	public Long getCourseScheduleId(){
-		return this.courseScheduleId;
+
+	public Date getSignInTime() {
+		return signInTime;
 	}
-			
-	public void setSignInTime(java.util.Date signInTime){
+
+	public void setSignInTime(Date signInTime) {
 		this.signInTime = signInTime;
 	}
-	
-	public java.util.Date getSignInTime(){
-		return this.signInTime;
-	}
 
 	public YesOrNoEnum getStatus() {
 		return status;
@@ -111,22 +113,22 @@ public class TeacherAttendance {
 		this.status = status;
 	}
 
-	public void setRemark(String remark){
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
 		this.remark = remark;
 	}
-	
-	public String getRemark(){
-		return this.remark;
+
+	public Date getCreateTime() {
+		return createTime;
 	}
-			
-	public void setCreateTime(java.util.Date createTime){
+
+	public void setCreateTime(Date createTime) {
 		this.createTime = createTime;
 	}
-	
-	public java.util.Date getCreateTime(){
-		return this.createTime;
-	}
-			
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 22 - 0
mec-web/src/main/java/com/ym/mec/web/dal/page/StudentAttendanceQueryInfo.java

@@ -0,0 +1,22 @@
+package com.ym.mec.web.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/12
+ */
+public class StudentAttendanceQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "班级ID",required = false)
+    private Long classId;
+
+    public Long getClassId() {
+        return classId;
+    }
+
+    public void setClassId(Long classId) {
+        this.classId = classId;
+    }
+}

+ 3 - 14
mec-web/src/main/java/com/ym/mec/web/service/CourseScheduleService.java

@@ -1,26 +1,15 @@
 package com.ym.mec.web.service;
 
 import com.ym.mec.common.service.BaseService;
-import com.ym.mec.web.dal.entity.CourseSchedule;
-import com.ym.mec.web.dal.dto.StudentAttendanceViewDto;
 import com.ym.mec.web.dal.dto.TeacherAttendanceDto;
-
-import java.util.List;
+import com.ym.mec.web.dal.entity.CourseSchedule;
 
 public interface CourseScheduleService extends BaseService<Long, CourseSchedule> {
 
     /**
      * @Author: Joburgess
      * @Date: 2019/9/10
-     * 根据教师ID获取当前课程的信息
-     */
-    TeacherAttendanceDto getCurrentCourseDetail(Integer teacherId);
-
-    /**
-     * @Author: Joburgess
-     * @Date: 2019/9/11
-     * 根据班级ID获取当前课程的学生
+     * 根据课程ID获取当前课程的信息
      */
-    List<StudentAttendanceViewDto> getCurrentCourseStudents(Long classID);
-
+    TeacherAttendanceDto getCurrentCourseDetail(Long teacherId);
 }

+ 0 - 1
mec-web/src/main/java/com/ym/mec/web/service/StudentAttendanceService.java

@@ -13,5 +13,4 @@ public interface StudentAttendanceService extends BaseService<Long, StudentAtten
      * 批量插入学生上课签到信息
      */
     void addStudentAttendances(List<StudentAttendance> studentAttendances);
-
 }

+ 10 - 13
mec-web/src/main/java/com/ym/mec/web/service/impl/CourseScheduleServiceImpl.java

@@ -1,17 +1,16 @@
 package com.ym.mec.web.service.impl;
 
-import com.ym.mec.web.dal.dto.StudentAttendanceViewDto;
-import com.ym.mec.web.dal.dto.TeacherAttendanceDto;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.web.dal.dao.CourseScheduleDao;
+import com.ym.mec.web.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.web.dal.entity.CourseSchedule;
+import com.ym.mec.web.dal.enums.ParamEnum;
 import com.ym.mec.web.service.CourseScheduleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
-import java.util.List;
+import java.util.Date;
 
 @Service
 public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSchedule>  implements CourseScheduleService {
@@ -25,12 +24,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	}
 
 	@Override
-	public TeacherAttendanceDto getCurrentCourseDetail(Integer teacherId) {
-		return courseScheduleDao.getCurrentCourseDetail(teacherId);
-	}
-
-	@Override
-	public List<StudentAttendanceViewDto> getCurrentCourseStudents(Long classID) {
-		return courseScheduleDao.getCurrentCourseStudents(classID);
+	public TeacherAttendanceDto getCurrentCourseDetail(Long teacherId) {
+		TeacherAttendanceDto currentCourseDetail = courseScheduleDao.getCurrentCourseDetail(teacherId);
+		currentCourseDetail.setCurrentTime(new Date());
+		currentCourseDetail.setTeacherAttendanceTimeGap(ParamEnum.TEACHER_ATTENDANCE_TIME_GAP);
+		return currentCourseDetail;
 	}
 }

+ 39 - 4
mec-web/src/main/java/com/ym/mec/web/service/impl/StudentAttendanceServiceImpl.java

@@ -1,13 +1,18 @@
 package com.ym.mec.web.service.impl;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.web.dal.dao.StudentAttendanceDao;
 import com.ym.mec.web.dal.entity.StudentAttendance;
+import com.ym.mec.web.dal.enums.StudentAttendanceStatusEnum;
+import com.ym.mec.web.dal.page.StudentAttendanceQueryInfo;
+import com.ym.mec.web.dal.utilEntity.StudentAttendancePageInfo;
+import com.ym.mec.web.dal.utilEntity.StudentStatusCountUtilEntity;
 import com.ym.mec.web.service.StudentAttendanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.util.List;
 
@@ -24,6 +29,36 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 
 	@Override
 	public void addStudentAttendances(List<StudentAttendance> studentAttendances) {
-		studentAttendanceDao.addStudentAttendances(studentAttendances);
+		studentAttendances.forEach(studentAttendance -> {
+			if(studentAttendance.getStatus()!= StudentAttendanceStatusEnum.DROP_OUT){
+				studentAttendanceDao.insert(studentAttendanceDao.getStudentAttendanceInfo(studentAttendance));
+			}
+		});
+	}
+
+	@Override
+	public StudentAttendancePageInfo queryPage(QueryInfo queryInfo) {
+		PageInfo pageInfo = super.queryPage(queryInfo);
+		StudentAttendancePageInfo studentAttendancePageInfo = new StudentAttendancePageInfo();
+
+		studentAttendancePageInfo.setPageNo(pageInfo.getPageNo());
+		studentAttendancePageInfo.setOffset(pageInfo.getOffset());
+		studentAttendancePageInfo.setLimit(pageInfo.getLimit());
+		studentAttendancePageInfo.setTotalPage(pageInfo.getTotalPage());
+		studentAttendancePageInfo.setTotal(pageInfo.getTotal());
+		studentAttendancePageInfo.setRows(pageInfo.getRows());
+
+		List<StudentStatusCountUtilEntity> stringIntegerMap = studentAttendanceDao.countStudentStatus(((StudentAttendanceQueryInfo) queryInfo).getClassId());
+
+		stringIntegerMap.forEach(studentStatusCount->{
+			switch (studentStatusCount.getStudentStatus()){
+				case LEAVE:
+					studentAttendancePageInfo.setNumberOfLeavePeoples(studentStatusCount.getNumberOfStudent());
+					break;
+
+			}
+		});
+
+		return studentAttendancePageInfo;
 	}
 }

+ 9 - 3
mec-web/src/main/java/com/ym/mec/web/service/impl/TeacherAttendanceServiceImpl.java

@@ -9,6 +9,7 @@ import com.ym.mec.web.dal.entity.TeacherAttendance;
 import com.ym.mec.web.dal.enums.CourseStatusEnum;
 import com.ym.mec.web.dal.enums.ParamEnum;
 import com.ym.mec.web.dal.enums.YesOrNoEnum;
+import com.ym.mec.web.dal.utilEntity.TeacherAttendanceViewUtilEntity;
 import com.ym.mec.web.service.TeacherAttendanceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -32,12 +33,14 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 
 	@Override
 	public void addTeacherAttendanceRecord(TeacherAttendance teacherAttendance) {
-		CourseSchedule courseSchedule = courseScheduleDao.get(teacherAttendance.getCourseScheduleId());
+		CourseSchedule courseSchedule=new CourseSchedule();
+		TeacherAttendanceViewUtilEntity currentCourseDetail = courseScheduleDao.getCurrentCourseDetail(teacherAttendance.getCourseScheduleId());
+		courseSchedule.setId(currentCourseDetail.getCourseScheduleId());
 		Date date = new Date();
 		if(teacherAttendance.getStatus()!= YesOrNoEnum.YES_QUIT){
-			StringBuilder startClassDateTimeString=new StringBuilder(new SimpleDateFormat("yyyy-MM-dd").format(courseSchedule.getClassDate()));
+			StringBuilder startClassDateTimeString=new StringBuilder(new SimpleDateFormat("yyyy-MM-dd").format(currentCourseDetail.getClassDate()));
 			startClassDateTimeString.append(" ");
-			startClassDateTimeString.append(new SimpleDateFormat("HH:mm:ss").format(courseSchedule.getStartClassTime()));
+			startClassDateTimeString.append(new SimpleDateFormat("HH:mm:ss").format(currentCourseDetail.getStartClassTime()));
 			Date startClassTime = null;
 			try {
 				startClassTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
@@ -56,6 +59,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			courseSchedule.setStatus(CourseStatusEnum.OVER);
 		}
 		courseScheduleDao.update(courseSchedule);
+		teacherAttendance.setMusicGroupId(currentCourseDetail.getMusicGroupId());
+		teacherAttendance.setSubjectId(currentCourseDetail.getSubjectId());
+		teacherAttendance.setClassGroupId(currentCourseDetail.getClassId());
 		teacherAttendance.setSignInTime(date);
 		teacherAttendance.setCreateTime(date);
 		teacherAttendanceDao.insert(teacherAttendance);

+ 3 - 2
mec-web/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -101,6 +101,7 @@
         <result property="endClassTime" column="end_class_time_"/>
         <result property="courseStatus" column="course_status_"/>
         <result property="classId" column="class_id"/>
+        <result property="subjectId" column="subject_id_"/>
         <result property="className" column="class_name"/>
         <result property="classType" column="class_type"/>
         <result property="musicGroupId" column="music_group_id"/>
@@ -119,6 +120,7 @@
             cs.end_class_time_,
             cs.status_ course_status_,
             cg.id_ class_id,
+            cg.subject_id_,
             cg.name_ class_name,
             cg.type_ class_type,
             mg.id_ music_group_id,
@@ -133,8 +135,7 @@
         LEFT JOIN school s ON mg.school_id_=s.id_
         WHERE
             DATE_FORMAT( class_date_, "%Y%m%d" ) = DATE_FORMAT( NOW(), "%Y%m%d" )
-            AND cs.teacher_id_= #{teacherID}
-        ORDER BY cs.start_class_time_ LIMIT 1
+            AND cs.id_= #{teacherID}
     </select>
 
     <resultMap id="studentAttendanceViewUtilEntity" type="com.ym.mec.web.dal.dto.StudentAttendanceViewDto">

+ 64 - 3
mec-web/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -87,14 +87,75 @@
 		DELETE FROM student_attendance WHERE id_ = #{id} 
 	</delete>
 
+    <resultMap id="studentAttendanceViewUtilEntity" type="com.ym.mec.web.dal.utilEntity.StudentAttendanceViewUtilEntity">
+        <result property="classGroupId" column="class_group_id_"/>
+        <result property="studentId" column="student_id_"/>
+        <result property="userName" column="username_"/>
+        <result property="musicGroupId" column="music_group_id_"/>
+        <result property="subjectId" column="subject_id_"/>
+        <result property="subjectName" column="subject_name_"/>
+        <result property="status" column="status_"/>
+    </resultMap>
+
     <!-- 分页查询 -->
-    <select id="queryPage" resultMap="StudentAttendance" parameterType="map">
-        SELECT * FROM student_attendance ORDER BY id_
+    <select id="queryPage" resultMap="studentAttendanceViewUtilEntity" parameterType="map">
+        SELECT
+        cgsm.class_group_id_,
+        su.id_ student_id_,
+        su.username_,
+        mg.id_ music_group_id_,
+        s.id_ subject_id_,
+        s.name_ subject_name_,
+        cgsm.status_
+        FROM
+        class_group cg
+        LEFT JOIN class_group_student_mapper cgsm ON cg.id_=cgsm.class_group_id_
+        LEFT JOIN sys_user su ON cgsm.user_id_=su.id_
+        LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
+        LEFT JOIN `subject` s ON cg.subject_id_=s.id_
+        WHERE cgsm.class_group_id_=#{classId}
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM student_attendance
+		SELECT COUNT(*)
+		FROM
+        class_group cg
+        LEFT JOIN class_group_student_mapper cgsm ON cg.id_=cgsm.class_group_id_
+        LEFT JOIN sys_user su ON cgsm.user_id_=su.id_
+        LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
+        LEFT JOIN `subject` s ON cg.subject_id_=s.id_
+        WHERE cgsm.class_group_id_=#{classId}
 	</select>
+
+    <select id="countStudentStatus" resultType="com.ym.mec.web.dal.utilEntity.StudentStatusCountUtilEntity">
+        SELECT
+            status_ studentStatus,
+            COUNT(user_id_) numberOfStudent
+        FROM
+            class_group_student_mapper
+        WHERE class_group_id_=#{classId}
+        GROUP BY status_
+    </select>
+
+    <select id="getStudentAttendanceInfo" parameterType="com.ym.mec.web.dal.entity.StudentAttendance" resultMap="StudentAttendance">
+        SELECT
+            cgsm.class_group_id_,
+            su.id_ user_id_,
+            mg.id_ music_group_id_,
+            s.id_ subject_id_,
+            #{teacherId} teacher_id_,
+            #{status} status_,
+            #{remark} remark_,
+            #{courseScheduleId} course_schedule_id_
+        FROM
+            sys_user su
+            LEFT JOIN class_group_student_mapper cgsm ON cgsm.user_id_ = su.id_
+            LEFT JOIN class_group cg ON cg.id_ = cgsm.class_group_id_
+            LEFT JOIN music_group mg ON cg.music_group_id_ = mg.id_
+            LEFT JOIN `subject` s ON cg.subject_id_ = s.id_
+        WHERE
+            su.id_=#{userId}
+    </select>
 </mapper>