springboot+layui+querydsl+mysql实现查询搜索分页排序

一、效果图

在这里插入图片描述
二、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
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值