package com.yanzhu.manage.service.impl;

import java.util.List;

import com.yanzhu.common.core.context.SecurityContextHolder;
import com.yanzhu.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.manage.mapper.AttendanceCfgMapper;
import com.yanzhu.manage.domain.AttendanceCfg;
import com.yanzhu.manage.service.IAttendanceCfgService;

/**
 * 考勤配置Service业务层处理
 * 
 * @author yanzhu
 * @date 2024-10-08
 */
@Service
public class AttendanceCfgServiceImpl implements IAttendanceCfgService 
{
    @Autowired
    private AttendanceCfgMapper attendanceCfgMapper;

    /**
     * 查询考勤配置
     * 
     * @param id 考勤配置主键
     * @return 考勤配置
     */
    @Override
    public AttendanceCfg selectAttendanceCfgById(Long id)
    {
        return attendanceCfgMapper.selectAttendanceCfgById(id);
    }

    /**
     * 查询考勤配置列表
     * 
     * @param attendanceCfg 考勤配置
     * @return 考勤配置
     */
    @Override
    public List<AttendanceCfg> selectAttendanceCfgList(AttendanceCfg attendanceCfg)
    {
        return attendanceCfgMapper.selectAttendanceCfgList(attendanceCfg);
    }

    /**
     * 新增考勤配置
     * 
     * @param attendanceCfg 考勤配置
     * @return 结果
     */
    @Override
    public int insertAttendanceCfg(AttendanceCfg attendanceCfg)
    {
        attendanceCfg.setCreateBy(SecurityContextHolder.getUserName());
        attendanceCfg.setCreateTime(DateUtils.getNowDate());
        return attendanceCfgMapper.insertAttendanceCfg(attendanceCfg);
    }

    /**
     * 修改考勤配置
     * 
     * @param attendanceCfg 考勤配置
     * @return 结果
     */
    @Override
    public int updateAttendanceCfg(AttendanceCfg attendanceCfg)
    {
        attendanceCfg.setUpdateBy(SecurityContextHolder.getUserName());
        attendanceCfg.setUpdateTime(DateUtils.getNowDate());
        return attendanceCfgMapper.updateAttendanceCfg(attendanceCfg);
    }

    /**
     * 批量删除考勤配置
     * 
     * @param ids 需要删除的考勤配置主键
     * @return 结果
     */
    @Override
    public int deleteAttendanceCfgByIds(Long[] ids)
    {
        return attendanceCfgMapper.deleteAttendanceCfgByIds(ids);
    }

    /**
     * 删除考勤配置信息
     * 
     * @param id 考勤配置主键
     * @return 结果
     */
    @Override
    public int deleteAttendanceCfgById(Long id)
    {
        return attendanceCfgMapper.deleteAttendanceCfgById(id);
    }
}
