package com.vctgo.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vctgo.system.domain.SysPlatformTeachQualifyCertificate;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vctgo.system.mapper.SysPlatformTeachQualifyCertificateMapper;
import com.vctgo.system.service.ISysPlatformTeachQualifyCertificateService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vctgo.common.core.text.Convert;
import com.vctgo.common.core.utils.ServletUtils;
import com.vctgo.common.mybatisplus.constant.MybatisPageConstants;

/**
 * 教职工与教师资格证关系Service业务层处理
 *
 * @author caesar
 * @date 2024-03-26
 */
@Api(tags = "教职工证书信息")
@Slf4j
@Service
public class SysPlatformTeachQualifyCertificateServiceImpl
        extends ServiceImpl<SysPlatformTeachQualifyCertificateMapper, SysPlatformTeachQualifyCertificate>
        implements ISysPlatformTeachQualifyCertificateService {

    @Autowired
    private SysPlatformTeachQualifyCertificateMapper sysPlatformTeachQualifyCertificateMapper;

    /**
     * 查询教职工与教师资格证关系
     *
     * @param id 教职工与教师资格证关系主键
     * @return 教职工与教师资格证关系
     */
    @Override
    public SysPlatformTeachQualifyCertificate selectSysTeachQualifyCertificateById(Long id) {
        return sysPlatformTeachQualifyCertificateMapper.selectById(id);
    }

    /**
     * 查询教职工与教师资格证关系列表-分页
     *
     * @param sysPlatformTeachQualifyCertificate 教职工与教师资格证关系
     * @return 教职工与教师资格证关系
     */
    @Override
    public IPage<SysPlatformTeachQualifyCertificate> selectSysTeachQualifyCertificatePage(SysPlatformTeachQualifyCertificate sysPlatformTeachQualifyCertificate) {
        Page mpPage = new Page(Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_NUM), 1L)
                , Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_SIZE), 10L));
        return sysPlatformTeachQualifyCertificateMapper.selectSysTeachQualifyCertificateList(mpPage, sysPlatformTeachQualifyCertificate);
    }

    /**
     * 查询教职工与教师资格证关系列表
     *
     * @param sysPlatformTeachQualifyCertificate 教职工与教师资格证关系
     * @return 教职工与教师资格证关系
     */
    @Override
    public List<SysPlatformTeachQualifyCertificate> selectSysTeachQualifyCertificateList(SysPlatformTeachQualifyCertificate sysPlatformTeachQualifyCertificate) {
        return sysPlatformTeachQualifyCertificateMapper.selectSysTeachQualifyCertificateList(sysPlatformTeachQualifyCertificate);
    }

    /**
     * 新增教职工与教师资格证关系
     *
     * @param sysPlatformTeachQualifyCertificate 教职工与教师资格证关系
     * @return 结果
     */

    @Override
    public int insertSysTeachQualifyCertificate(SysPlatformTeachQualifyCertificate sysPlatformTeachQualifyCertificate) {
        return sysPlatformTeachQualifyCertificateMapper.insert(sysPlatformTeachQualifyCertificate);
    }

    /**
     * 修改教职工与教师资格证关系
     *
     * @param sysPlatformTeachQualifyCertificate 教职工与教师资格证关系
     * @return 结果
     */
    @Override
    public int updateSysTeachQualifyCertificate(SysPlatformTeachQualifyCertificate sysPlatformTeachQualifyCertificate) {
        return sysPlatformTeachQualifyCertificateMapper.updateById(sysPlatformTeachQualifyCertificate);
    }

    /**
     * 逻辑删除教职工与教师资格证关系
     *
     * @param ids 需要删除的教职工与教师资格证关系主键
     * @return 结果
     */
    @Override
    public int logicalDeleteSysTeachQualifyCertificateByIds(Long[] ids) {
        SysPlatformTeachQualifyCertificate sysPlatformTeachQualifyCertificate = new SysPlatformTeachQualifyCertificate();
//        sysPlatformTeachQualifyCertificate.setUpdateById(SecurityUtils.getUserId());
//        sysPlatformTeachQualifyCertificate.setUpdateBy(SecurityUtils.getUsername());
//        sysPlatformTeachQualifyCertificate.setUpdateTime(new Date());
//        sysPlatformTeachQualifyCertificate.setIsDeleted(ConstantUtils.IS_DELETED_1);
        return sysPlatformTeachQualifyCertificateMapper.logicalDeleteSysTeachQualifyCertificateByIds(ids, sysPlatformTeachQualifyCertificate);
    }

    /**
     * 批量删除教职工与教师资格证关系
     *
     * @param ids 需要删除的教职工与教师资格证关系主键
     * @return 结果
     */
    @Override
    public int deleteSysTeachQualifyCertificateByIds(Long[] ids) {
        return sysPlatformTeachQualifyCertificateMapper.deleteSysTeachQualifyCertificateByIds(ids);
    }

    /**
     * 删除教职工与教师资格证关系信息
     *
     * @param id 教职工与教师资格证关系主键
     * @return 结果
     */
    @Override
    public int deleteSysTeachQualifyCertificateById(Long id) {
        return sysPlatformTeachQualifyCertificateMapper.deleteById(id);
    }
}
