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.SysTeacherStuTalkMaterialsMapper;
import com.srs.teacher.domain.SysTeacherStuTalkMaterials;
import com.srs.teacher.service.ISysTeacherStuTalkMaterialsService;

/**
 * 与带班学生谈心谈话Service业务层处理
 *
 * @author chc
 * @date 2024-06-05
 */
@Service
public class SysTeacherStuTalkMaterialsServiceImpl extends ServiceImpl<SysTeacherStuTalkMaterialsMapper, SysTeacherStuTalkMaterials> implements ISysTeacherStuTalkMaterialsService {
    @Autowired
    private SysTeacherStuTalkMaterialsMapper sysTeacherStuTalkMaterialsMapper;

    /**
     * 查询与带班学生谈心谈话
     *
     * @param id 与带班学生谈心谈话主键
     * @return 与带班学生谈心谈话
     */
    @Override
    public SysTeacherStuTalkMaterials selectSysTeacherStuTalkMaterialsById(Long id) {
        return sysTeacherStuTalkMaterialsMapper.selectSysTeacherStuTalkMaterialsById(id);
    }

    /**
     * 查询与带班学生谈心谈话列表
     *
     * @param sysTeacherStuTalkMaterials 与带班学生谈心谈话
     * @return 与带班学生谈心谈话
     */
    @Override
    public List<SysTeacherStuTalkMaterials> selectSysTeacherStuTalkMaterialsList(SysTeacherStuTalkMaterials sysTeacherStuTalkMaterials) {
        sysTeacherStuTalkMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuTalkMaterialsMapper.selectSysTeacherStuTalkMaterialsList(sysTeacherStuTalkMaterials);
    }

    /**
     * 查根据辅导员名称、年份 月份 查询
     *
     * @param fdyName 辅导员名称
     * @return 与带班学生谈心谈话集合
     */
    @Override
    public List<SysTeacherStuTalkMaterials> selectSysTeacherStuTalkMaterialsByFdyName(String fdyName, String fillingYear, String fillingMonth) {
        return sysTeacherStuTalkMaterialsMapper.selectSysTeacherStuTalkMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
    }

    /**
     * 新增与带班学生谈心谈话
     *
     * @param sysTeacherStuTalkMaterials 与带班学生谈心谈话
     * @return 结果
     */
    @Override
    public int insertSysTeacherStuTalkMaterials(SysTeacherStuTalkMaterials sysTeacherStuTalkMaterials) {
        sysTeacherStuTalkMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherStuTalkMaterials.getId() != null) {
            return sysTeacherStuTalkMaterialsMapper.updateSysTeacherStuTalkMaterials(sysTeacherStuTalkMaterials);
        }
        return sysTeacherStuTalkMaterialsMapper.insertSysTeacherStuTalkMaterials(sysTeacherStuTalkMaterials);
    }

    /**
     * 修改与带班学生谈心谈话
     *
     * @param sysTeacherStuTalkMaterials 与带班学生谈心谈话
     * @return 结果
     */
    @Override
    public int updateSysTeacherStuTalkMaterials(SysTeacherStuTalkMaterials sysTeacherStuTalkMaterials) {
        sysTeacherStuTalkMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuTalkMaterialsMapper.updateSysTeacherStuTalkMaterials(sysTeacherStuTalkMaterials);
    }

    /**
     * 批量删除与带班学生谈心谈话
     *
     * @param ids 需要删除的与带班学生谈心谈话主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuTalkMaterialsByIds(Long[] ids) {
        return sysTeacherStuTalkMaterialsMapper.deleteSysTeacherStuTalkMaterialsByIds(ids);
    }

    /**
     * 删除与带班学生谈心谈话信息
     *
     * @param id 与带班学生谈心谈话主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuTalkMaterialsById(Long id) {
        return sysTeacherStuTalkMaterialsMapper.deleteSysTeacherStuTalkMaterialsById(id);
    }
}
