package com.srs.teacher.service.impl;

import java.util.List;

import com.srs.common.utils.SecurityUtils;
import com.srs.teacher.domain.SysTeacherKpiFillingStuMgt;
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.SysTeacherStuActivityMaterialsMapper;
import com.srs.teacher.domain.SysTeacherStuActivityMaterials;
import com.srs.teacher.service.ISysTeacherStuActivityMaterialsService;

/**
 * 学生开展活动佐证材料Service业务层处理
 *
 * @author chc
 * @date 2024-06-05
 */
@Service
public class SysTeacherStuActivityMaterialsServiceImpl extends ServiceImpl<SysTeacherStuActivityMaterialsMapper, SysTeacherStuActivityMaterials> implements ISysTeacherStuActivityMaterialsService {
    @Autowired
    private SysTeacherStuActivityMaterialsMapper sysTeacherStuActivityMaterialsMapper;

    /**
     * 查询学生开展活动佐证材料
     *
     * @param id 学生开展活动佐证材料主键
     * @return 学生开展活动佐证材料
     */
    @Override
    public SysTeacherStuActivityMaterials selectSysTeacherStuActivityMaterialsById(Long id) {
        return sysTeacherStuActivityMaterialsMapper.selectSysTeacherStuActivityMaterialsById(id);
    }

    /**
     * 查询学生开展活动佐证材料列表
     *
     * @param sysTeacherStuActivityMaterials 学生开展活动佐证材料
     * @return 学生开展活动佐证材料
     */
    @Override
    public List<SysTeacherStuActivityMaterials> selectSysTeacherStuActivityMaterialsList(SysTeacherStuActivityMaterials sysTeacherStuActivityMaterials) {
        sysTeacherStuActivityMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuActivityMaterialsMapper.selectSysTeacherStuActivityMaterialsList(sysTeacherStuActivityMaterials);
    }

    /**
     * 查根据辅导员名称、年份 月份 查询
     *
     * @param fdyName 辅导员名称
     * @return 生开展活动佐证材料集合
     */
    @Override
    public List<SysTeacherStuActivityMaterials> selectSysTeacherStuActivityMaterialsByFdyName(String fdyName, String fillingYear, String fillingMonth) {
        return sysTeacherStuActivityMaterialsMapper.selectSysTeacherStuActivityMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
    }

    /**
     * 新增学生开展活动佐证材料
     *
     * @param sysTeacherStuActivityMaterials 学生开展活动佐证材料
     * @return 结果
     */
    @Override
    public int insertSysTeacherStuActivityMaterials(SysTeacherStuActivityMaterials sysTeacherStuActivityMaterials) {
        sysTeacherStuActivityMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherStuActivityMaterials.getId() != null) {
            return sysTeacherStuActivityMaterialsMapper.updateSysTeacherStuActivityMaterials(sysTeacherStuActivityMaterials);
        }
        return sysTeacherStuActivityMaterialsMapper.insertSysTeacherStuActivityMaterials(sysTeacherStuActivityMaterials);
    }

    /**
     * 修改学生开展活动佐证材料
     *
     * @param sysTeacherStuActivityMaterials 学生开展活动佐证材料
     * @return 结果
     */
    @Override
    public int updateSysTeacherStuActivityMaterials(SysTeacherStuActivityMaterials sysTeacherStuActivityMaterials) {
        sysTeacherStuActivityMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuActivityMaterialsMapper.updateSysTeacherStuActivityMaterials(sysTeacherStuActivityMaterials);
    }

    /**
     * 批量删除学生开展活动佐证材料
     *
     * @param ids 需要删除的学生开展活动佐证材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuActivityMaterialsByIds(Long[] ids) {
        return sysTeacherStuActivityMaterialsMapper.deleteSysTeacherStuActivityMaterialsByIds(ids);
    }

    /**
     * 删除学生开展活动佐证材料信息
     *
     * @param id 学生开展活动佐证材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuActivityMaterialsById(Long id) {
        return sysTeacherStuActivityMaterialsMapper.deleteSysTeacherStuActivityMaterialsById(id);
    }
}
