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.SysTeachOtherAchievementMapper;
import com.vctgo.system.domain.SysTeachOtherAchievement;
import com.vctgo.system.service.ISysTeachOtherAchievementService;
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 SysTeachOtherAchievementServiceImpl implements ISysTeachOtherAchievementService {
    @Autowired
    private SysTeachOtherAchievementMapper sysTeachOtherAchievementMapper;

    /**
     * 查询幼儿园教职工与其它成果关联
     *
     * @param id 幼儿园教职工与其它成果关联主键
     * @return 幼儿园教职工与其它成果关联
     */
    @Override
    public SysTeachOtherAchievement selectSysTeachOtherAchievementById(Long id) {
        return sysTeachOtherAchievementMapper.selectById(id);
    }

    /**
     * 查询幼儿园教职工与其它成果关联列表-分页
     *
     * @param sysTeachOtherAchievement 幼儿园教职工与其它成果关联
     * @return 幼儿园教职工与其它成果关联
     */
    @Override
    public IPage<SysTeachOtherAchievement> selectSysTeachOtherAchievementPage(SysTeachOtherAchievement sysTeachOtherAchievement) {
        Page mpPage = new Page(Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_NUM), 1L)
                , Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_SIZE), 10L));
        return sysTeachOtherAchievementMapper.selectSysTeachOtherAchievementList(mpPage, sysTeachOtherAchievement);
    }

    /**
     * 查询幼儿园教职工与其它成果关联列表
     *
     * @param sysTeachOtherAchievement 幼儿园教职工与其它成果关联
     * @return 幼儿园教职工与其它成果关联
     */
    @Override
    public List<SysTeachOtherAchievement> selectSysTeachOtherAchievementList(SysTeachOtherAchievement sysTeachOtherAchievement) {
        return sysTeachOtherAchievementMapper.selectSysTeachOtherAchievementList(sysTeachOtherAchievement);
    }

    /**
     * 新增幼儿园教职工与其它成果关联
     *
     * @param sysTeachOtherAchievement 幼儿园教职工与其它成果关联
     * @return 结果
     */

    @Override
    public int insertSysTeachOtherAchievement(SysTeachOtherAchievement sysTeachOtherAchievement) {
        return sysTeachOtherAchievementMapper.insert(sysTeachOtherAchievement);
    }

    /**
     * 修改幼儿园教职工与其它成果关联
     *
     * @param sysTeachOtherAchievement 幼儿园教职工与其它成果关联
     * @return 结果
     */
    @Override
    public int updateSysTeachOtherAchievement(SysTeachOtherAchievement sysTeachOtherAchievement) {
        return sysTeachOtherAchievementMapper.updateById(sysTeachOtherAchievement);
    }

    /**
     * 逻辑删除幼儿园教职工与其它成果关联
     *
     * @param ids 需要删除的幼儿园教职工与其它成果关联主键
     * @return 结果
     */
    @Override
    public int logicalDeleteSysTeachOtherAchievementByIds(Long[] ids) {
        SysTeachOtherAchievement sysTeachOtherAchievement = new SysTeachOtherAchievement();
        sysTeachOtherAchievement.setUpdateById(SecurityUtils.getUserId());
        sysTeachOtherAchievement.setUpdateBy(SecurityUtils.getUsername());
        sysTeachOtherAchievement.setUpdateTime(new Date());
        sysTeachOtherAchievement.setIsDeleted(ConstantUtils.IS_DELETED_1);
        return sysTeachOtherAchievementMapper.logicalDeleteSysTeachOtherAchievementByIds(ids, sysTeachOtherAchievement);
    }

    /**
     * 批量删除幼儿园教职工与其它成果关联
     *
     * @param ids 需要删除的幼儿园教职工与其它成果关联主键
     * @return 结果
     */
    @Override
    public int deleteSysTeachOtherAchievementByIds(Long[] ids) {
        return sysTeachOtherAchievementMapper.deleteSysTeachOtherAchievementByIds(ids);
    }

    /**
     * 删除幼儿园教职工与其它成果关联信息
     *
     * @param id 幼儿园教职工与其它成果关联主键
     * @return 结果
     */
    @Override
    public int deleteSysTeachOtherAchievementById(Long id) {
        return sysTeachOtherAchievementMapper.deleteById(id);
    }
}
