package com.xueyi.system.common.manager.impl;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl;
import com.xueyi.system.common.domain.dto.DmHolidayDto;
import com.xueyi.system.common.domain.model.DmHolidayConverter;
import com.xueyi.system.common.domain.po.DmHolidayPo;
import com.xueyi.system.common.domain.query.DmHolidayQuery;
import com.xueyi.system.common.manager.IDmHolidayManager;
import com.xueyi.system.common.mapper.DmHolidayMapper;

import org.springframework.stereotype.Component;

import java.util.List;


/**
 * 动作管理
管理 数据封装层处理
 *
 * @author xueyi
 */
@Component
public class DmHolidayManager extends BaseManagerImpl<DmHolidayQuery, DmHolidayDto, DmHolidayPo, DmHolidayMapper, DmHolidayConverter> implements IDmHolidayManager {

    @Override
    public DmHolidayDto selectTodayHoliday(DmHolidayQuery query) {
        List<DmHolidayPo> poList = baseMapper.selectList(Wrappers.<DmHolidayPo>query().lambda()
                .eq(DmHolidayPo::getDate, query.getDate()));
        if (poList != null && poList.size() > 0) {
            return baseConverter.mapperDto(poList.get(0));
        }
        return null;
    }
}