package com.vctgo.system.service.impl;

import java.util.List;
import java.util.Date;

import com.vctgo.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vctgo.system.mapper.SysTeachQualifyCertificateMapper;
import com.vctgo.system.domain.SysTeachQualifyCertificate;
import com.vctgo.system.service.ISysTeachQualifyCertificateService;
import com.vctgo.system.util.ConstantUtils;
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-27
 */
@Slf4j
@Service
public class SysTeachQualifyCertificateServiceImpl implements ISysTeachQualifyCertificateService {
    @Autowired
    private SysTeachQualifyCertificateMapper sysTeachQualifyCertificateMapper;

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

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

    /**
     * 查询幼儿园教职工与教师资格证关系列表
     *
     * @param sysTeachQualifyCertificate 幼儿园教职工与教师资格证关系
     * @return 幼儿园教职工与教师资格证关系
     */
    @Override
    public List<SysTeachQualifyCertificate> selectSysTeachQualifyCertificateList(SysTeachQualifyCertificate sysTeachQualifyCertificate) {
        return sysTeachQualifyCertificateMapper.selectSysTeachQualifyCertificateList(sysTeachQualifyCertificate);
    }

    /**
     * 新增幼儿园教职工与教师资格证关系
     *
     * @param sysTeachQualifyCertificate 幼儿园教职工与教师资格证关系
     * @return 结果
     */

    @Override
    public int insertSysTeachQualifyCertificate(SysTeachQualifyCertificate sysTeachQualifyCertificate) {
        return sysTeachQualifyCertificateMapper.insert(sysTeachQualifyCertificate);
    }

    /**
     * 修改幼儿园教职工与教师资格证关系
     *
     * @param sysTeachQualifyCertificate 幼儿园教职工与教师资格证关系
     * @return 结果
     */
    @Override
    public int updateSysTeachQualifyCertificate(SysTeachQualifyCertificate sysTeachQualifyCertificate) {
        return sysTeachQualifyCertificateMapper.updateById(sysTeachQualifyCertificate);
    }

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

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

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