package com.dcsoft.system.kq.service.impl;


import com.dcsoft.common.core.utils.DateUtils;
import com.dcsoft.system.kq.domain.KqHolidayGroup;
import com.dcsoft.system.kq.mapper.KqHolidayGroupMapper;
import com.dcsoft.system.kq.service.IKqHolidayGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 假期设置Service业务层处理
 *
 * @author dcsoft
 * @date 2023-01-11
 */
@Service
public class KqHolidayGroupServiceImpl implements IKqHolidayGroupService
{
    @Autowired
    private KqHolidayGroupMapper kqHolidayMapper;

    /**
     * 查询假期设置
     *
     * @param holidayId 假期设置主键
     * @return 假期设置
     */
    @Override
    public KqHolidayGroup selectKqHolidayGroupByHolidayId(Long holidayId)
    {
        return kqHolidayMapper.selectKqHolidayGroupByHolidayId(holidayId);
    }

    /**
     * 查询假期设置列表
     *
     * @param kqHoliday 假期设置
     * @return 假期设置
     */
    @Override
    public List<KqHolidayGroup> selectKqHolidayGroupList(KqHolidayGroup kqHoliday)
    {
        return kqHolidayMapper.selectKqHolidayGroupList(kqHoliday);
    }

    /**
     * 新增假期设置
     *
     * @param kqHoliday 假期设置
     * @return 结果
     */
    @Override
    public int insertKqHolidayGroup(KqHolidayGroup kqHoliday)
    {
        kqHoliday.setCreateTime(DateUtils.getNowDate());
        return kqHolidayMapper.insertKqHolidayGroup(kqHoliday);
    }

    /**
     * 修改假期设置
     *
     * @param kqHoliday 假期设置
     * @return 结果
     */
    @Override
    public int updateKqHolidayGroup(KqHolidayGroup kqHoliday)
    {
        kqHoliday.setUpdateTime(DateUtils.getNowDate());
        return kqHolidayMapper.updateKqHolidayGroup(kqHoliday);
    }

    /**
     * 批量删除假期设置
     *
     * @param holidayIds 需要删除的假期设置主键
     * @return 结果
     */
    @Override
    public int deleteKqHolidayGroupByHolidayIds(Long[] holidayIds)
    {
        return kqHolidayMapper.deleteKqHolidayGroupByHolidayIds(holidayIds);
    }

    /**
     * 删除假期设置信息
     *
     * @param holidayId 假期设置主键
     * @return 结果
     */
    @Override
    public int deleteKqHolidayGroupByHolidayId(Long holidayId)
    {
        return kqHolidayMapper.deleteKqHolidayGroupByHolidayId(holidayId);
    }

    @Override
    public KqHolidayGroup selectKqHolidayGroupByHolidayTimeStamp(Long timeStamp,Long groupId) {
        return kqHolidayMapper.selectKqHolidayGroupByHolidayTimeStamp(timeStamp,groupId);
    }

    /**
     * 删除假期设置信息
     *
     * @param timeStamp 假期设置主键
     * @return 结果
     */
    @Override
    public int deleteKqHolidayGroupByHolidayTimeStamp(Long timeStamp,Long groupId)
    {
        return kqHolidayMapper.deleteKqHolidayGroupByHolidayTimeStamp(timeStamp,groupId);

    }

}
