package com.srs.comprehensive.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.srs.comprehensive.domain.CphStuEvaTask;
import com.srs.comprehensive.domain.CphTeacher;
import com.srs.comprehensive.domain.Dto.CphEvaStuPub;
import com.srs.comprehensive.domain.Vo.ClassIdName;
import com.srs.comprehensive.domain.Vo.StuNoName;
import com.srs.comprehensive.domain.Vo.StuYearIdName;
import com.srs.comprehensive.mapper.CphStuEvaTaskMapper;
import com.srs.comprehensive.mapper.SrsClassMapper;
import com.srs.comprehensive.mapper.SrsStuYearMapper;
import com.srs.comprehensive.mapper.SrsStudentMapper;
import com.srs.comprehensive.service.ICphStuEvaTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 综合评价评定小组任务Service业务层处理
 * 
 * @author srs
 * @date 2023-08-19
 */
@Service
public class CphStuEvaTaskServiceImpl implements ICphStuEvaTaskService
{
    @Autowired
    private CphStuEvaTaskMapper cphStuEvaTaskMapper;

    @Autowired
    public CphTeacherServiceImpl _teacherService;

    @Autowired
    private SrsClassMapper _classMapper;

    @Autowired
    private SrsStudentMapper _stuMapper;

    @Autowired
    private SrsStuYearMapper _stuYearMapper;


    public List<StuYearIdName> listStuYear(){
        List<StuYearIdName> res = _stuYearMapper.selectStuYearIdName();
        return res;
    }

    public int pubTask(CphEvaStuPub param){
        return 0;
    }


    /**
     * 通过班级列出学生
     * @author zhy
     * @date 2023-08-19 15:42:37
     * @param id
     * @return
     **/
    public List<StuNoName> listOwnStuByClass(Long id){
        List<StuNoName> res = _stuMapper.selectStuNoNameByClass(id);
        return res;
    }

    /**
     * 列出自己的班级
     * @author zhy
     * @date 2023-08-19 15:24:45
     * @param tno
     * @return
     **/
    public List<ClassIdName> listOwnClass(String tno){
        CphTeacher t = _teacherService.searchTeacherByEmployeeId(tno);
        if(t == null){
            return new ArrayList<>();
        }
        Long t_id = t.getTeacherId();
        List<ClassIdName> c = _classMapper.selectClassIdNameByTid(t_id);
        return c;
    }

    /**
     * 查询综合评价评定小组任务
     * 
     * @param id 综合评价评定小组任务主键
     * @return 综合评价评定小组任务
     */
    @Override
    public CphStuEvaTask selectCphStuEvaTaskById(Long id)
    {
        return cphStuEvaTaskMapper.selectCphStuEvaTaskById(id);
    }

    /**
     * 查询综合评价评定小组任务列表
     * 
     * @param cphStuEvaTask 综合评价评定小组任务
     * @return 综合评价评定小组任务
     */
    @Override
    public List<CphStuEvaTask> selectCphStuEvaTaskList(CphStuEvaTask cphStuEvaTask)
    {
        return cphStuEvaTaskMapper.selectCphStuEvaTaskList(cphStuEvaTask);
    }

    /**
     * 新增综合评价评定小组任务
     * 
     * @param cphStuEvaTask 综合评价评定小组任务
     * @return 结果
     */
    @Override
    public int insertCphStuEvaTask(CphStuEvaTask cphStuEvaTask)
    {
        return cphStuEvaTaskMapper.insertCphStuEvaTask(cphStuEvaTask);
    }

    /**
     * 修改综合评价评定小组任务
     * 
     * @param cphStuEvaTask 综合评价评定小组任务
     * @return 结果
     */
    @Override
    public int updateCphStuEvaTask(CphStuEvaTask cphStuEvaTask)
    {
        return cphStuEvaTaskMapper.updateCphStuEvaTask(cphStuEvaTask);
    }

    /**
     * 批量删除综合评价评定小组任务
     * 
     * @param ids 需要删除的综合评价评定小组任务主键
     * @return 结果
     */
    @Override
    public int deleteCphStuEvaTaskByIds(Long[] ids)
    {
        return cphStuEvaTaskMapper.deleteCphStuEvaTaskByIds(ids);
    }

    /**
     * 删除综合评价评定小组任务信息
     * 
     * @param id 综合评价评定小组任务主键
     * @return 结果
     */
    @Override
    public int deleteCphStuEvaTaskById(Long id)
    {
        return cphStuEvaTaskMapper.deleteCphStuEvaTaskById(id);
    }
}
