package com.yida.data.school.classSchedule.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.classschedule.EduSemester;
import com.yida.data.school.classSchedule.mapper.EduSemesterMapper;
import com.yida.data.school.classSchedule.service.EduSemesterService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 学期管理表 Service实现
 *
 * @author wjm
 * @date 2021-08-13 11:28:42
 */
@Service
@RequiredArgsConstructor
@Transactional
public class EduSemesterServiceImpl extends ServiceImpl<EduSemesterMapper, EduSemester> implements EduSemesterService {

    private final EduSemesterMapper eduSemesterMapper;

    @Override
    public EduSemester getSemesterByDate(String date) {
        EduSemester one = getOne(Wrappers.lambdaQuery(new EduSemester())
                .le(EduSemester::getBeginDate, date)
                .gt(EduSemester::getEndDate, date));
        return one;
    }
}
