package com.srs.teacher.service.impl;

import java.util.List;

import com.srs.common.exception.ServiceException;
import com.srs.common.utils.SecurityUtils;
import com.srs.teacher.domain.SysTeacherKpiFillingBusinessWork;
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.SysTeacherKpiFillingNegativeListMapper;
import com.srs.teacher.domain.SysTeacherKpiFillingNegativeList;
import com.srs.teacher.service.ISysTeacherKpiFillingNegativeListService;

/**
 * 业绩考核-个人填报-负面清单Service业务层处理
 *
 * @author chc
 * @date 2024-06-12
 */
@Service
public class SysTeacherKpiFillingNegativeListServiceImpl extends ServiceImpl<SysTeacherKpiFillingNegativeListMapper,SysTeacherKpiFillingNegativeList> implements ISysTeacherKpiFillingNegativeListService {
    @Autowired
    private SysTeacherKpiFillingNegativeListMapper sysTeacherKpiFillingNegativeListMapper;

    /**
     * 查询业绩考核-个人填报-负面清单
     *
     * @param id 业绩考核-个人填报-负面清单主键
     * @return 业绩考核-个人填报-负面清单
     */
    @Override
    public SysTeacherKpiFillingNegativeList selectSysTeacherKpiFillingNegativeListById(Long id) {
        return sysTeacherKpiFillingNegativeListMapper.selectSysTeacherKpiFillingNegativeListById(id);
    }

    /**
     * 查询业绩考核-个人填报-负面清单列表
     *
     * @param sysTeacherKpiFillingNegativeList 业绩考核-个人填报-负面清单
     * @return 业绩考核-个人填报-负面清单
     */
    @Override
    public List<SysTeacherKpiFillingNegativeList> selectSysTeacherKpiFillingNegativeListList(SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
        sysTeacherKpiFillingNegativeList.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherKpiFillingNegativeListMapper.selectSysTeacherKpiFillingNegativeListList(sysTeacherKpiFillingNegativeList);
    }

    /**
     * 查根据辅导员名称、年份 月份 查询
     *
     * @param fdyName 辅导员名称
     * @return 业绩考核-个人填报-负面清单集合
     */
    @Override
    public List<SysTeacherKpiFillingNegativeList> selectSysTeacherKpiFillingNegativeListByFdyName(String fdyName, String fillingYear, String fillingMonth, String classType) {
        return sysTeacherKpiFillingNegativeListMapper.selectSysTeacherKpiFillingNegativeListByFdyName(fdyName, fillingYear, fillingMonth, classType);
    }

    /**
     * 新增业绩考核-个人填报-负面清单
     *
     * @param sysTeacherKpiFillingNegativeList 业绩考核-个人填报-负面清单
     * @return 结果
     */
    @Override
    public int insertSysTeacherKpiFillingNegativeList(SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
            return sysTeacherKpiFillingNegativeListMapper.insertSysTeacherKpiFillingNegativeList(sysTeacherKpiFillingNegativeList);
    }

    /**
     * 修改业绩考核-个人填报-负面清单
     *
     * @param sysTeacherKpiFillingNegativeList 业绩考核-个人填报-负面清单
     * @return 结果
     */
    @Override
    public int updateSysTeacherKpiFillingNegativeList(SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
        // 判断填报记录是否填报
        /*List<SysTeacherKpiFillingNegativeList> sysTeacherKpiFillingNegativeLists = sysTeacherKpiFillingNegativeListMapper.selectSysTeacherKpiFillingNegativeListByFdyName(sysTeacherKpiFillingNegativeList.getFdyName(), sysTeacherKpiFillingNegativeList.getFillingYear(), sysTeacherKpiFillingNegativeList.getFillingMonth(), sysTeacherKpiFillingNegativeList.getClassType());
        if (sysTeacherKpiFillingNegativeLists != null && !sysTeacherKpiFillingNegativeLists.isEmpty()) {
            throw new ServiceException("已提交，请勿重复提交", 500);
        }*/
        return sysTeacherKpiFillingNegativeListMapper.updateSysTeacherKpiFillingNegativeList(sysTeacherKpiFillingNegativeList);
    }

    /**
     * 批量删除业绩考核-个人填报-负面清单
     *
     * @param ids 需要删除的业绩考核-个人填报-负面清单主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherKpiFillingNegativeListByIds(Long[] ids) {
        return sysTeacherKpiFillingNegativeListMapper.deleteSysTeacherKpiFillingNegativeListByIds(ids);
    }

    /**
     * 删除业绩考核-个人填报-负面清单信息
     *
     * @param id 业绩考核-个人填报-负面清单主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherKpiFillingNegativeListById(Long id) {
        return sysTeacherKpiFillingNegativeListMapper.deleteSysTeacherKpiFillingNegativeListById(id);
    }
}
