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.SysTeacherClassMeetingMaterialsMapper;
import com.srs.teacher.domain.SysTeacherClassMeetingMaterials;
import com.srs.teacher.service.ISysTeacherClassMeetingMaterialsService;

/**
 * 班会佐证材料Service业务层处理
 *
 * @author chc
 * @date 2024-06-05
 */
@Service
public class SysTeacherClassMeetingMaterialsServiceImpl extends ServiceImpl<SysTeacherClassMeetingMaterialsMapper, SysTeacherClassMeetingMaterials> implements ISysTeacherClassMeetingMaterialsService {
    @Autowired
    private SysTeacherClassMeetingMaterialsMapper sysTeacherClassMeetingMaterialsMapper;

    /**
     * 查询班会佐证材料
     *
     * @param id 班会佐证材料主键
     * @return 班会佐证材料
     */
    @Override
    public SysTeacherClassMeetingMaterials selectSysTeacherClassMeetingMaterialsById(Long id) {
        return sysTeacherClassMeetingMaterialsMapper.selectSysTeacherClassMeetingMaterialsById(id);
    }

    /**
     * 根据辅导员名称、年份 月份 查询业绩考核-个人填报
     *
     * @param fdyName 辅导员名称主键
     * @return 业绩考核-个人填报
     */
    @Override
    public List<SysTeacherClassMeetingMaterials> selectSysTeacherClassMeetingMaterialsByFdyName(String fdyName, String fillingYear, String fillingMonth) {
        return sysTeacherClassMeetingMaterialsMapper.selectSysTeacherClassMeetingMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
    }

    /**
     * 查询班会佐证材料列表
     *
     * @param sysTeacherClassMeetingMaterials 班会佐证材料
     * @return 班会佐证材料
     */
    @Override
    public List<SysTeacherClassMeetingMaterials> selectSysTeacherClassMeetingMaterialsList(SysTeacherClassMeetingMaterials sysTeacherClassMeetingMaterials) {
        sysTeacherClassMeetingMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherClassMeetingMaterialsMapper.selectSysTeacherClassMeetingMaterialsList(sysTeacherClassMeetingMaterials);
    }

    /**
     * 新增班会佐证材料
     *
     * @param sysTeacherClassMeetingMaterials 班会佐证材料
     * @return 结果
     */
    @Override
    public int insertSysTeacherClassMeetingMaterials(SysTeacherClassMeetingMaterials sysTeacherClassMeetingMaterials) {
        sysTeacherClassMeetingMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherClassMeetingMaterials.getId() != null) {
            return sysTeacherClassMeetingMaterialsMapper.updateSysTeacherClassMeetingMaterials(sysTeacherClassMeetingMaterials);
        }
        return sysTeacherClassMeetingMaterialsMapper.insertSysTeacherClassMeetingMaterials(sysTeacherClassMeetingMaterials);
    }

    /**
     * 修改班会佐证材料
     *
     * @param sysTeacherClassMeetingMaterials 班会佐证材料
     * @return 结果
     */
    @Override
    public int updateSysTeacherClassMeetingMaterials(SysTeacherClassMeetingMaterials sysTeacherClassMeetingMaterials) {
        sysTeacherClassMeetingMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherClassMeetingMaterialsMapper.updateSysTeacherClassMeetingMaterials(sysTeacherClassMeetingMaterials);
    }

    /**
     * 批量删除班会佐证材料
     *
     * @param ids 需要删除的班会佐证材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherClassMeetingMaterialsByIds(Long[] ids) {
        return sysTeacherClassMeetingMaterialsMapper.deleteSysTeacherClassMeetingMaterialsByIds(ids);
    }

    /**
     * 删除班会佐证材料信息
     *
     * @param id 班会佐证材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherClassMeetingMaterialsById(Long id) {
        return sysTeacherClassMeetingMaterialsMapper.deleteSysTeacherClassMeetingMaterialsById(id);
    }
}
