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.SysTeacherKpiFillingBonusPointsMapper;
import com.srs.teacher.domain.SysTeacherKpiFillingBonusPoints;
import com.srs.teacher.service.ISysTeacherKpiFillingBonusPointsService;

/**
 * 业绩考核-个人填报-加分项Service业务层处理
 *
 * @author
 * @date 2024-06-11
 */
@Service
public class SysTeacherKpiFillingBonusPointsServiceImpl extends ServiceImpl<SysTeacherKpiFillingBonusPointsMapper, SysTeacherKpiFillingBonusPoints> implements ISysTeacherKpiFillingBonusPointsService {
    @Autowired
    private SysTeacherKpiFillingBonusPointsMapper sysTeacherKpiFillingBonusPointsMapper;

    /**
     * 查询业绩考核-个人填报-加分项
     *
     * @param id 业绩考核-个人填报-加分项主键
     * @return 业绩考核-个人填报-加分项
     */
    @Override
    public SysTeacherKpiFillingBonusPoints selectSysTeacherKpiFillingBonusPointsById(Long id) {
        return sysTeacherKpiFillingBonusPointsMapper.selectSysTeacherKpiFillingBonusPointsById(id);
    }

    /**
     * 查询业绩考核-个人填报-加分项列表
     *
     * @param sysTeacherKpiFillingBonusPoints 业绩考核-个人填报-加分项
     * @return 业绩考核-个人填报-加分项
     */
    @Override
    public List<SysTeacherKpiFillingBonusPoints> selectSysTeacherKpiFillingBonusPointsList(SysTeacherKpiFillingBonusPoints sysTeacherKpiFillingBonusPoints) {
        sysTeacherKpiFillingBonusPoints.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherKpiFillingBonusPointsMapper.selectSysTeacherKpiFillingBonusPointsList(sysTeacherKpiFillingBonusPoints);
    }

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

    /**
     * 新增业绩考核-个人填报-加分项
     *
     * @param sysTeacherKpiFillingBonusPoints 业绩考核-个人填报-加分项
     * @return 结果
     */
    @Override
    public int insertSysTeacherKpiFillingBonusPoints(SysTeacherKpiFillingBonusPoints sysTeacherKpiFillingBonusPoints) {
        sysTeacherKpiFillingBonusPoints.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherKpiFillingBonusPoints.getId() != null) {
            return sysTeacherKpiFillingBonusPointsMapper.updateSysTeacherKpiFillingBonusPoints(sysTeacherKpiFillingBonusPoints);
        }
        return sysTeacherKpiFillingBonusPointsMapper.insertSysTeacherKpiFillingBonusPoints(sysTeacherKpiFillingBonusPoints);
    }

    /**
     * 修改业绩考核-个人填报-加分项
     *
     * @param sysTeacherKpiFillingBonusPoints 业绩考核-个人填报-加分项
     * @return 结果
     */
    @Override
    public int updateSysTeacherKpiFillingBonusPoints(SysTeacherKpiFillingBonusPoints sysTeacherKpiFillingBonusPoints) {
        return sysTeacherKpiFillingBonusPointsMapper.updateSysTeacherKpiFillingBonusPoints(sysTeacherKpiFillingBonusPoints);
    }

    /**
     * 批量删除业绩考核-个人填报-加分项
     *
     * @param ids 需要删除的业绩考核-个人填报-加分项主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherKpiFillingBonusPointsByIds(Long[] ids) {
        return sysTeacherKpiFillingBonusPointsMapper.deleteSysTeacherKpiFillingBonusPointsByIds(ids);
    }

    /**
     * 删除业绩考核-个人填报-加分项信息
     *
     * @param id 业绩考核-个人填报-加分项主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherKpiFillingBonusPointsById(Long id) {
        return sysTeacherKpiFillingBonusPointsMapper.deleteSysTeacherKpiFillingBonusPointsById(id);
    }
}
