package com.srs.stureg.service.impl;

import java.util.List;

import com.srs.stureg.domain.SrsStuReg;
import com.srs.stureg.mapper.SrsStuRegMapper;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.stureg.mapper.SrsStuCheckMapper;
import com.srs.stureg.domain.SrsStuCheck;
import com.srs.stureg.service.ISrsStuCheckService;

/**
 * 报到核验Service业务层处理
 *
 * @author srs
 * @date 2024-09-09
 */
@Service
public class SrsStuCheckServiceImpl extends ServiceImpl<SrsStuCheckMapper,SrsStuCheck> implements ISrsStuCheckService {
    @Autowired
    private SrsStuCheckMapper srsStuCheckMapper;
    @Autowired
    private SrsStuRegMapper srsStuRegMapper;
    /**
     * 查询报到核验
     *
     * @param id 报到核验主键
     * @return 报到核验
     */
    @Override
    public SrsStuCheck selectSrsStuCheckById(Long id) {
        return srsStuCheckMapper.selectSrsStuCheckById(id);
    }

    /**
     * 查询报到核验列表
     *
     * @param srsStuCheck 报到核验
     * @return 报到核验
     */
    @Override
    public List<SrsStuCheck> selectSrsStuCheckList(SrsStuCheck srsStuCheck) {
        List<SrsStuCheck> list=srsStuCheckMapper.selectSrsStuCheckList(srsStuCheck);
        for (int i=0;i<list.size();i++){
            SrsStuReg stu=srsStuRegMapper.getOwnInfoByKsh(list.get(i).getKsh());
            if (stu != null) {
                list.get(i).setStuinfo(stu);
            }
        }
        return list;
    }

    /**
     * 新增报到核验
     *
     * @param srsStuCheck 报到核验
     * @return 结果
     */
    @Override
    public int insertSrsStuCheck(SrsStuCheck srsStuCheck) {
            return srsStuCheckMapper.insertSrsStuCheck(srsStuCheck);
    }

    /**
     * 修改报到核验
     *
     * @param srsStuCheck 报到核验
     * @return 结果
     */
    @Override
    public int updateSrsStuCheck(SrsStuCheck srsStuCheck) {
        return srsStuCheckMapper.updateSrsStuCheck(srsStuCheck);
    }

    /**
     * 批量删除报到核验
     *
     * @param ids 需要删除的报到核验主键
     * @return 结果
     */
    @Override
    public int deleteSrsStuCheckByIds(Long[] ids) {
        return srsStuCheckMapper.deleteSrsStuCheckByIds(ids);
    }

    /**
     * 删除报到核验信息
     *
     * @param id 报到核验主键
     * @return 结果
     */
    @Override
    public int deleteSrsStuCheckById(Long id) {
        return srsStuCheckMapper.deleteSrsStuCheckById(id);
    }

    @Override
    public SrsStuCheck getowmInfo(String ksh) {
        SrsStuCheck stu =srsStuCheckMapper.getowmByksh(ksh);
        SrsStuReg reg=srsStuRegMapper.getOwnInfoByKsh(ksh);
        stu.setStuinfo(reg);
        return stu;
    }
}
