package com.vctgo.system.service.impl;

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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.SysPlatformExpertEducationMapper;
import com.vctgo.system.domain.SysPlatformExpertEducation;
import com.vctgo.system.service.ISysPlatformExpertEducationService;
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 SysPlatformExpertEducationServiceImpl
        extends ServiceImpl<SysPlatformExpertEducationMapper, SysPlatformExpertEducation>
        implements ISysPlatformExpertEducationService {
    @Autowired
    private SysPlatformExpertEducationMapper sysPlatformExpertEducationMapper;

    /**
     * 查询专家与学历关联
     *
     * @param id 专家与学历关联主键
     * @return 专家与学历关联
     */
    @Override
    public SysPlatformExpertEducation selectSysPlatformExpertEducationById(Long id) {
        return sysPlatformExpertEducationMapper.selectById(id);
    }

    /**
     * 查询专家与学历关联列表-分页
     *
     * @param sysPlatformExpertEducation 专家与学历关联
     * @return 专家与学历关联
     */
    @Override
    public IPage<SysPlatformExpertEducation> selectSysPlatformExpertEducationPage(SysPlatformExpertEducation sysPlatformExpertEducation) {
        Page mpPage = new Page(Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_NUM), 1L)
                , Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_SIZE), 10L));
        return sysPlatformExpertEducationMapper.selectSysPlatformExpertEducationList(mpPage, sysPlatformExpertEducation);
    }

    /**
     * 查询专家与学历关联列表
     *
     * @param sysPlatformExpertEducation 专家与学历关联
     * @return 专家与学历关联
     */
    @Override
    public List<SysPlatformExpertEducation> selectSysPlatformExpertEducationList(SysPlatformExpertEducation sysPlatformExpertEducation) {
        return sysPlatformExpertEducationMapper.selectSysPlatformExpertEducationList(sysPlatformExpertEducation);
    }

    /**
     * 新增专家与学历关联
     *
     * @param sysPlatformExpertEducation 专家与学历关联
     * @return 结果
     */

    @Override
    public int insertSysPlatformExpertEducation(SysPlatformExpertEducation sysPlatformExpertEducation) {
        return sysPlatformExpertEducationMapper.insert(sysPlatformExpertEducation);
    }

    /**
     * 修改专家与学历关联
     *
     * @param sysPlatformExpertEducation 专家与学历关联
     * @return 结果
     */
    @Override
    public int updateSysPlatformExpertEducation(SysPlatformExpertEducation sysPlatformExpertEducation) {
        return sysPlatformExpertEducationMapper.updateById(sysPlatformExpertEducation);
    }

    /**
     * 逻辑删除专家与学历关联
     *
     * @param ids 需要删除的专家与学历关联主键
     * @return 结果
     */
    @Override
    public int logicalDeleteSysPlatformExpertEducationByIds(Long[] ids) {
        SysPlatformExpertEducation sysPlatformExpertEducation = new SysPlatformExpertEducation();
        sysPlatformExpertEducation.setUpdateById(SecurityUtils.getUserId());
        sysPlatformExpertEducation.setUpdateBy(SecurityUtils.getUsername());
        sysPlatformExpertEducation.setUpdateTime(new Date());
        sysPlatformExpertEducation.setIsDeleted(ConstantUtils.IS_DELETED_1);
        return sysPlatformExpertEducationMapper.logicalDeleteSysPlatformExpertEducationByIds(ids, sysPlatformExpertEducation);
    }

    /**
     * 批量删除专家与学历关联
     *
     * @param ids 需要删除的专家与学历关联主键
     * @return 结果
     */
    @Override
    public int deleteSysPlatformExpertEducationByIds(Long[] ids) {
        return sysPlatformExpertEducationMapper.deleteSysPlatformExpertEducationByIds(ids);
    }

    /**
     * 删除专家与学历关联信息
     *
     * @param id 专家与学历关联主键
     * @return 结果
     */
    @Override
    public int deleteSysPlatformExpertEducationById(Long id) {
        return sysPlatformExpertEducationMapper.deleteById(id);
    }
}
