一、效果图
二、controller层
三、service层
public Object getAttendanceList(Integer pageSize, Integer pageNum, String sortName, String direction,
List<Map<String, Object>> para) {
List<Map<String, Object>> listData = new ArrayList<>();
QAttendance qAttendance = QAttendance.attendance;
QStudent qStudent = QStudent.student;
QClass qClass = QClass.class$;
QSchool qSchool=QSchool.school;
List<Predicate> predicates = new ArrayList<>();
if (!para.isEmpty()) {
for (Map<String, Object> map : para) {
if (map.get("searchStudentName") != null) {
predicates.add(qStudent.studentName.like("%" + map.get("searchStudentName").toString() + "%"));
}else if (map.get("className") != null) {
predicates.add(qClass.className.like("%" + map.get("className").toString() + "%"));
}else if (map.get("specificDate") != null) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
predicates.add(qAttendance.specificDate.eq(simpleDateFormat.parse(map.get("specificDate").toString())));
} catch (ParseException e) {
e.printStackTrace();
}
}
}
}
AccountAuthentic account = (AccountAuthentic) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//account.getUsername();
//System.out.println(account.getUsername());
if (account.getSchoolId() != -1) {
predicates.add(qStudent.schoolId.eq(account.getSchoolId()));
}
JPAQuery<Tuple> jPAQuery = jpaQueryFactory
.selectDistinct(qAttendance.inTime,qSchool.schoolName, qAttendance.outTime, qAttendance.homeTime, qAttendance.specificDate, qAtt