| | |
| | | return holidayCalendarMapper.selectList(new LambdaQueryWrapper<HolidayCalendar>() |
| | | .eq(HolidayCalendar::getYear, year) |
| | | .eq(HolidayCalendar::getHolidayType, holidayType) |
| | | .ge(HolidayCalendar::getDayIndex, 1) |
| | | .orderByAsc(HolidayCalendar::getDayIndex)); |
| | | } |
| | | |
| | | public HolidayCalendar findPreviousDay(int year, String holidayType) { |
| | | return holidayCalendarMapper.selectOne(new LambdaQueryWrapper<HolidayCalendar>() |
| | | .eq(HolidayCalendar::getYear, year) |
| | | .eq(HolidayCalendar::getHolidayType, holidayType) |
| | | .eq(HolidayCalendar::getDayIndex, 0) |
| | | .last("limit 1")); |
| | | } |
| | | |
| | | public HolidayCalendar findHolidayByDate(LocalDate date) { |
| | |
| | | if (holidayDate == null || holidayDate.getYear() != year) { |
| | | throw new IllegalArgumentException("日期必须属于所选年份"); |
| | | } |
| | | if (dayIndex == null || dayIndex < 1) { |
| | | throw new IllegalArgumentException("第几日必须从 1 开始"); |
| | | if (dayIndex == null || dayIndex < 0) { |
| | | throw new IllegalArgumentException("日期序号不能小于 0"); |
| | | } |
| | | LambdaQueryWrapper<HolidayCalendar> duplicate = new LambdaQueryWrapper<HolidayCalendar>() |
| | | .eq(HolidayCalendar::getYear, year) |