package com.srs.teacher.service.impl;

import java.util.List;

import com.srs.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.teacher.mapper.SysTeacherKpiFillingAMgtMapper;
import com.srs.teacher.domain.SysTeacherKpiFillingAMgt;
import com.srs.teacher.service.ISysTeacherKpiFillingAMgtService;

/**
 * 业绩考核-个人填报-考勤管理Service业务层处理
 *
 * @author chc
 * @date 2024-06-11
 */
@Service
public class SysTeacherKpiFillingAMgtServiceImpl extends ServiceImpl<SysTeacherKpiFillingAMgtMapper, SysTeacherKpiFillingAMgt> implements ISysTeacherKpiFillingAMgtService {
    @Autowired
    private SysTeacherKpiFillingAMgtMapper sysTeacherKpiFillingAMgtMapper;

    /**
     * 查询业绩考核-个人填报-考勤管理
     *
     * @param id 业绩考核-个人填报-考勤管理主键
     * @return 业绩考核-个人填报-考勤管理
     */
    @Override
    public SysTeacherKpiFillingAMgt selectSysTeacherKpiFillingAMgtById(Long id) {
        return sysTeacherKpiFillingAMgtMapper.selectSysTeacherKpiFillingAMgtById(id);
    }

    /**
     * 查询业绩考核-个人填报-考勤管理列表
     *
     * @param sysTeacherKpiFillingAMgt 业绩考核-个人填报-考勤管理
     * @return 业绩考核-个人填报-考勤管理
     */
    @Override
    public List<SysTeacherKpiFillingAMgt> selectSysTeacherKpiFillingAMgtList(SysTeacherKpiFillingAMgt sysTeacherKpiFillingAMgt) {
        sysTeacherKpiFillingAMgt.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherKpiFillingAMgtMapper.selectSysTeacherKpiFillingAMgtList(sysTeacherKpiFillingAMgt);
    }

    /**
     * 根据辅导员名称、年份 月份 查询
     *
     * @param fdyName 辅导员名称主键
     * @return 业绩考核-个人填报-考勤管理集合
     */
    @Override
    public List<SysTeacherKpiFillingAMgt> selectSysTeacherKpiFillingAMgtByFdyName(String fdyName, String fillingYear, String fillingMonth, String classType) {
        return sysTeacherKpiFillingAMgtMapper.selectSysTeacherKpiFillingAMgtByFdyName(fdyName, fillingYear, fillingMonth, classType);
    }

    /**
     * 新增业绩考核-个人填报-考勤管理
     *
     * @param sysTeacherKpiFillingAMgt 业绩考核-个人填报-考勤管理
     * @return 结果
     */
    @Override
    public int insertSysTeacherKpiFillingAMgt(SysTeacherKpiFillingAMgt sysTeacherKpiFillingAMgt) {
        sysTeacherKpiFillingAMgt.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherKpiFillingAMgt.getId() != null) {
            return sysTeacherKpiFillingAMgtMapper.updateSysTeacherKpiFillingAMgt(sysTeacherKpiFillingAMgt);
        }
        return sysTeacherKpiFillingAMgtMapper.insertSysTeacherKpiFillingAMgt(sysTeacherKpiFillingAMgt);
    }

    /**
     * 修改业绩考核-个人填报-考勤管理
     *
     * @param sysTeacherKpiFillingAMgt 业绩考核-个人填报-考勤管理
     * @return 结果
     */
    @Override
    public int updateSysTeacherKpiFillingAMgt(SysTeacherKpiFillingAMgt sysTeacherKpiFillingAMgt) {
//        sysTeacherKpiFillingAMgt.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherKpiFillingAMgtMapper.updateSysTeacherKpiFillingAMgt(sysTeacherKpiFillingAMgt);
    }

    /**
     * 批量删除业绩考核-个人填报-考勤管理
     *
     * @param ids 需要删除的业绩考核-个人填报-考勤管理主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherKpiFillingAMgtByIds(Long[] ids) {
        return sysTeacherKpiFillingAMgtMapper.deleteSysTeacherKpiFillingAMgtByIds(ids);
    }

    /**
     * 删除业绩考核-个人填报-考勤管理信息
     *
     * @param id 业绩考核-个人填报-考勤管理主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherKpiFillingAMgtById(Long id) {
        return sysTeacherKpiFillingAMgtMapper.deleteSysTeacherKpiFillingAMgtById(id);
    }
}
