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.SysTeacherStuTestMaterialsMapper;
import com.srs.teacher.domain.SysTeacherStuTestMaterials;
import com.srs.teacher.service.ISysTeacherStuTestMaterialsService;

/**
 * 职业测评材料Service实现
 *
 * @author chc
 * @date 2024-06-06
 */
@Service
public class SysTeacherStuTestMaterialsServiceImpl extends ServiceImpl<SysTeacherStuTestMaterialsMapper, SysTeacherStuTestMaterials> implements ISysTeacherStuTestMaterialsService {

    @Autowired
    private SysTeacherStuTestMaterialsMapper sysTeacherStuTestMaterialsMapper;

    @Override
    public SysTeacherStuTestMaterials selectSysTeacherStuTestMaterialsById(Long id) {
        return sysTeacherStuTestMaterialsMapper.selectSysTeacherStuTestMaterialsById(id);
    }

    /**
     * 查询职业测评材料
     *
     * @param sysTeacherStuTestMaterials 职业测评材料
     * @return 职业测评材料
     */
    @Override
    public List<SysTeacherStuTestMaterials> selectSysTeacherStuTestMaterialsList(SysTeacherStuTestMaterials sysTeacherStuTestMaterials) {
        sysTeacherStuTestMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuTestMaterialsMapper.selectSysTeacherStuTestMaterialsList(sysTeacherStuTestMaterials);
    }

    @Override
    public List<SysTeacherStuTestMaterials> selectSysTeacherStuTestMaterialsByFdyName(String fdyName, String fillingYear, String fillingMonth) {
        return sysTeacherStuTestMaterialsMapper.selectSysTeacherStuTestMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
    }

    /**
     * 新增职业测评材料
     *
     * @param sysTeacherStuTestMaterials 职业测评材料
     * @return 结果
     */
    @Override
    public int insertSysTeacherStuTestMaterials(SysTeacherStuTestMaterials sysTeacherStuTestMaterials) {
        sysTeacherStuTestMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        if (sysTeacherStuTestMaterials.getId() != null) {
            return sysTeacherStuTestMaterialsMapper.updateSysTeacherStuTestMaterials(sysTeacherStuTestMaterials);
        }
        return sysTeacherStuTestMaterialsMapper.insertSysTeacherStuTestMaterials(sysTeacherStuTestMaterials);
    }

    /**
     * 修改职业测评材料
     *
     * @param sysTeacherStuTestMaterials 职业测评材料
     * @return 结果
     */
    @Override
    public int updateSysTeacherStuTestMaterials(SysTeacherStuTestMaterials sysTeacherStuTestMaterials) {
        sysTeacherStuTestMaterials.setFdyName(SecurityUtils.getLoginUser().getUser().getNickName());
        return sysTeacherStuTestMaterialsMapper.updateSysTeacherStuTestMaterials(sysTeacherStuTestMaterials);
    }

    /**
     * 批量删除职业测评材料
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuTestMaterialsByIds(Long[] ids) {
        return sysTeacherStuTestMaterialsMapper.deleteSysTeacherStuTestMaterialsByIds(ids);
    }

    /**
     * 删除职业测评材料信息
     *
     * @param id 职业测评材料主键
     * @return 结果
     */
    @Override
    public int deleteSysTeacherStuTestMaterialsById(Long id) {
        return sysTeacherStuTestMaterialsMapper.deleteSysTeacherStuTestMaterialsById(id);
    }
}
