package com.zd.exam.service.impl;

import java.util.List;

import com.zd.common.core.utils.DateUtils;
import com.zd.common.core.utils.SecurityUtils;
import com.zd.system.api.domain.SysUser;
import com.zd.common.core.utils.SpringUtils;
import com.zd.common.security.service.TokenService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.exam.mapper.ElExamCertRelationMapper;
import com.zd.exam.domain.ElExamCertRelation;
import com.zd.exam.service.IElExamCertRelationService;

/**
 * 考试证书关联Service业务层处理
 *
 * @author zd
 * @date 2021-09-10
 */
@Service
public class ElExamCertRelationServiceImpl implements IElExamCertRelationService {
    @Autowired
    private ElExamCertRelationMapper elExamCertRelationMapper;

    /**
     * 查询考试证书关联
     *
     * @param id 考试证书关联主键
     * @return 考试证书关联
     */
    @Override
    public ElExamCertRelation selectElExamCertRelationById(Long id) {
        return elExamCertRelationMapper.selectElExamCertRelationById(id);
    }

    /**
     * 查询考试证书关联列表
     *
     * @param elExamCertRelation 考试证书关联
     * @return 考试证书关联
     */
    @Override
    public List<ElExamCertRelation> selectElExamCertRelationList(ElExamCertRelation elExamCertRelation) {
        return elExamCertRelationMapper.selectElExamCertRelationList(elExamCertRelation);
    }

    /**
     * 新增考试证书关联
     *
     * @param elExamCertRelation 考试证书关联
     * @return 结果
     */
    @Override
    public int insertElExamCertRelation(ElExamCertRelation elExamCertRelation) {
        SysUser sysUser = SpringUtils.getBean(TokenService.class).getLoginUser().getSysUser();
        return elExamCertRelationMapper.insertElExamCertRelation(elExamCertRelation);
    }

    /**
     * 修改考试证书关联
     *
     * @param elExamCertRelation 考试证书关联
     * @return 结果
     */
    @Override
    public int updateElExamCertRelation(ElExamCertRelation elExamCertRelation) {
        return elExamCertRelationMapper.updateElExamCertRelation(elExamCertRelation);
    }

    /**
     * 批量删除考试证书关联
     *
     * @param ids 需要删除的考试证书关联主键
     * @return 结果
     */
    @Override
    public int deleteElExamCertRelationByIds(Long[] ids) {
        return elExamCertRelationMapper.deleteElExamCertRelationByIds(ids);
    }

    /**
     * 删除考试证书关联信息
     *
     * @param id 考试证书关联主键
     * @return 结果
     */
    @Override
    public int deleteElExamCertRelationById(Long id) {
        return elExamCertRelationMapper.deleteElExamCertRelationById(id);
    }
}
