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.SysTeacherVisitDormitoryMaterialsMapper;
import com.srs.teacher.domain.SysTeacherVisitDormitoryMaterials;
import com.srs.teacher.service.ISysTeacherVisitDormitoryMaterialsService;

/**
 * 每周深入学生宿舍佐证材料Service业务层处理
 *
 * @author chc
 * @date 2024-06-05
 */
@Service
public class SysTeacherVisitDormitoryMaterialsServiceImpl extends ServiceImpl<SysTeacherVisitDormitoryMaterialsMapper, SysTeacherVisitDormitoryMaterials> implements ISysTeacherVisitDormitoryMaterialsService {
    @Autowired
    private SysTeacherVisitDormitoryMaterialsMapper sysTeacherVisitDormitoryMaterialsMapper;

    /**
     * 查询每周深入学生宿舍佐证材料
     *
     * @param id 每周深入学生宿舍佐证材料主键
     * @return 每周深入学生宿舍佐证材料
     */
    @Override
    public SysTeacherVisitDormitoryMaterials selectSysTeacherVisitDormitoryMaterialsById(Long id) {
        return sysTeacherVisitDormitoryMaterialsMapper.selectSysTeacherVisitDormitoryMaterialsById(id);
    }

    /**
     * 查询每周深入学生宿舍佐证材料列表
     *
     * @param sysTeacherVisitDormitoryMaterials 每周深入学生宿舍佐证材料
     * @return 每周深入学生宿舍佐证材料
     */
    @Override
    public List<SysTeacherVisitDormitoryMaterials> selectSysTeacherVisitDormitoryMaterialsList(SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        sysTeacherVisitDormitoryMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherVisitDormitoryMaterialsMapper.selectSysTeacherVisitDormitoryMaterialsList(sysTeacherVisitDormitoryMaterials);
    }

    /**
     * 查根据辅导员名称、年份 月份 查询
     *
     * @param fdyName 辅导员名称
     * @return 每周深入学生宿舍佐证材料集合
     */
    @Override
    public List<SysTeacherVisitDormitoryMaterials> selectSysTeacherVisitDormitoryMaterialsByFdyName(String fdyName, String fillingYear, String fillingMonth) {
        return sysTeacherVisitDormitoryMaterialsMapper.selectSysTeacherVisitDormitoryMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
    }

    /**
     * 新增每周深入学生宿舍佐证材料
     *
     * @param sysTeacherVisitDormitoryMaterials 每周深入学生宿舍佐证材料
     * @return 结果
     */
    @Override
    public int insertSysTeacherVisitDormitoryMaterials(SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        sysTeacherVisitDormitoryMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherVisitDormitoryMaterials.getId() != null) {
            return sysTeacherVisitDormitoryMaterialsMapper.updateSysTeacherVisitDormitoryMaterials(sysTeacherVisitDormitoryMaterials);
        }
        return sysTeacherVisitDormitoryMaterialsMapper.insertSysTeacherVisitDormitoryMaterials(sysTeacherVisitDormitoryMaterials);
    }

    /**
     * 修改每周深入学生宿舍佐证材料
     *
     * @param sysTeacherVisitDormitoryMaterials 每周深入学生宿舍佐证材料
     * @return 结果
     */
    @Override
    public int updateSysTeacherVisitDormitoryMaterials(SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        sysTeacherVisitDormitoryMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherVisitDormitoryMaterialsMapper.updateSysTeacherVisitDormitoryMaterials(sysTeacherVisitDormitoryMaterials);
    }

    /**
     * 批量删除每周深入学生宿舍佐证材料
     *
     * @param ids 需要删除的每周深入学生宿舍佐证材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherVisitDormitoryMaterialsByIds(Long[] ids) {
        return sysTeacherVisitDormitoryMaterialsMapper.deleteSysTeacherVisitDormitoryMaterialsByIds(ids);
    }

    /**
     * 删除每周深入学生宿舍佐证材料信息
     *
     * @param id 每周深入学生宿舍佐证材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherVisitDormitoryMaterialsById(Long id) {
        return sysTeacherVisitDormitoryMaterialsMapper.deleteSysTeacherVisitDormitoryMaterialsById(id);
    }
}
