Assert.notNull(time,"请选择时间"); //定义时间格式 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date timeDate = null; //将string类型转换为date类型 try { timeDate = simpleDateFormat.parse(time); } catch (ParseException e) { e.printStackTrace(); } //把日期往后增加一天.整数往后推,负数往前移动 Calendar calendar = new GregorianCalendar(); calendar.setTime(timeDate); calendar.add(calendar.DATE, 1); OAccessRecord record = accessRecordMapper.selectOne(new LambdaQueryWrapper<OAccessRecord>() .eq(OAccessRecord::getLicensePlateNum, licensePlateNumber) .gt(OAccessRecord::getEntryTime, time)// .lt(OAccessRecord::getEntryTime, DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",calendar.getTime())));//把时间转换为string类型 String licensePlateNum = record.getLicensePlateNum();