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.SysTeacherStuNoticeMaterialsMapper;
import com.srs.teacher.domain.SysTeacherStuNoticeMaterials;
import com.srs.teacher.service.ISysTeacherStuNoticeMaterialsService;

/**
 * 通知任务材料Service实现
 *
 * @author chc
 * @date 2024-06-06
 */
@Service
public class SysTeacherStuNoticeMaterialsServiceImpl extends ServiceImpl<SysTeacherStuNoticeMaterialsMapper, SysTeacherStuNoticeMaterials> implements ISysTeacherStuNoticeMaterialsService {

    @Autowired
    private SysTeacherStuNoticeMaterialsMapper sysTeacherStuNoticeMaterialsMapper;

    @Override
    public SysTeacherStuNoticeMaterials selectSysTeacherStuNoticeMaterialsById(Long id) {
        return sysTeacherStuNoticeMaterialsMapper.selectSysTeacherStuNoticeMaterialsById(id);
    }

    /**
     * 查询通知任务材料
     *
     * @param sysTeacherStuNoticeMaterials 通知任务材料
     * @return 通知任务材料
     */
    @Override
    public List<SysTeacherStuNoticeMaterials> selectSysTeacherStuNoticeMaterialsList(SysTeacherStuNoticeMaterials sysTeacherStuNoticeMaterials) {
        sysTeacherStuNoticeMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuNoticeMaterialsMapper.selectSysTeacherStuNoticeMaterialsList(sysTeacherStuNoticeMaterials);
    }

    @Override
    public List<SysTeacherStuNoticeMaterials> selectSysTeacherStuNoticeMaterialsByFdyName(String fdyName, String fillingYear, String fillingMonth) {
        return sysTeacherStuNoticeMaterialsMapper.selectSysTeacherStuNoticeMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
    }

    /**
     * 新增通知任务材料
     *
     * @param sysTeacherStuNoticeMaterials 通知任务材料
     * @return 结果
     */
    @Override
    public int insertSysTeacherStuNoticeMaterials(SysTeacherStuNoticeMaterials sysTeacherStuNoticeMaterials) {
        sysTeacherStuNoticeMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherStuNoticeMaterials.getId() != null) {
            return sysTeacherStuNoticeMaterialsMapper.updateSysTeacherStuNoticeMaterials(sysTeacherStuNoticeMaterials);
        }
        return sysTeacherStuNoticeMaterialsMapper.insertSysTeacherStuNoticeMaterials(sysTeacherStuNoticeMaterials);
    }

    /**
     * 修改通知任务材料
     *
     * @param sysTeacherStuNoticeMaterials 通知任务材料
     * @return 结果
     */
    @Override
    public int updateSysTeacherStuNoticeMaterials(SysTeacherStuNoticeMaterials sysTeacherStuNoticeMaterials) {
        sysTeacherStuNoticeMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuNoticeMaterialsMapper.updateSysTeacherStuNoticeMaterials(sysTeacherStuNoticeMaterials);
    }

    /**
     * 批量删除通知任务材料
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuNoticeMaterialsByIds(Long[] ids) {
        return sysTeacherStuNoticeMaterialsMapper.deleteSysTeacherStuNoticeMaterialsByIds(ids);
    }

    /**
     * 删除通知任务材料信息
     *
     * @param id 通知任务材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuNoticeMaterialsById(Long id) {
        return sysTeacherStuNoticeMaterialsMapper.deleteSysTeacherStuNoticeMaterialsById(id);
    }
}
