You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
|
1 week ago
|
package com.student.servlet.admin;
|
||
|
|
|
||
|
|
import com.student.bean.AttendanceStats;
|
||
|
|
import com.student.bean.Course;
|
||
|
|
import com.student.service.AttendanceService;
|
||
|
|
import com.student.service.CourseService;
|
||
|
|
import com.student.servlet.BaseServlet;
|
||
|
|
import com.student.util.ParamUtil;
|
||
|
|
|
||
|
|
import javax.servlet.ServletException;
|
||
|
|
import javax.servlet.annotation.WebServlet;
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
import java.io.IOException;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 管理员 - 考勤统计
|
||
|
|
*/
|
||
|
|
@WebServlet("/admin/attendanceStats")
|
||
|
|
public class AttendanceStatsServlet extends BaseServlet {
|
||
|
|
|
||
|
|
private final AttendanceService attendanceService = new AttendanceService();
|
||
|
|
private final CourseService courseService = new CourseService();
|
||
|
|
|
||
|
|
@Override
|
||
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||
|
|
throws ServletException, IOException {
|
||
|
|
int courseId = ParamUtil.getInt(request, "courseId", 0);
|
||
|
|
List<Course> courseList = courseService.findAll();
|
||
|
|
request.setAttribute("courseList", courseList);
|
||
|
|
AttendanceStats stats = new AttendanceStats();
|
||
|
|
if (courseId > 0) {
|
||
|
|
request.setAttribute("courseId", courseId);
|
||
|
|
stats = attendanceService.getStatsByCourse(courseId);
|
||
|
|
}
|
||
|
|
request.setAttribute("stats", stats);
|
||
|
|
request.getRequestDispatcher("/admin/attendance_stats.jsp").forward(request, response);
|
||
|
|
}
|
||
|
|
}
|