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.SysTeachHonoraryAchievementMapper;
import com.vctgo.system.domain.SysTeachHonoraryAchievement;
import com.vctgo.system.service.ISysTeachHonoraryAchievementService;
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 SysTeachHonoraryAchievementServiceImpl implements ISysTeachHonoraryAchievementService {
    @Autowired
    private SysTeachHonoraryAchievementMapper sysTeachHonoraryAchievementMapper;

    /**
     * 查询幼儿园教职工与荣誉成果关联
     *
     * @param id 幼儿园教职工与荣誉成果关联主键
     * @return 幼儿园教职工与荣誉成果关联
     */
    @Override
    public SysTeachHonoraryAchievement selectSysTeachHonoraryAchievementById(Long id) {
        return sysTeachHonoraryAchievementMapper.selectById(id);
    }

    /**
     * 查询幼儿园教职工与荣誉成果关联列表-分页
     *
     * @param sysTeachHonoraryAchievement 幼儿园教职工与荣誉成果关联
     * @return 幼儿园教职工与荣誉成果关联
     */
    @Override
    public IPage<SysTeachHonoraryAchievement> selectSysTeachHonoraryAchievementPage(SysTeachHonoraryAchievement sysTeachHonoraryAchievement) {
        Page mpPage = new Page(Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_NUM), 1L)
                , Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_SIZE), 10L));
        return sysTeachHonoraryAchievementMapper.selectSysTeachHonoraryAchievementList(mpPage, sysTeachHonoraryAchievement);
    }

    /**
     * 查询幼儿园教职工与荣誉成果关联列表
     *
     * @param sysTeachHonoraryAchievement 幼儿园教职工与荣誉成果关联
     * @return 幼儿园教职工与荣誉成果关联
     */
    @Override
    public List<SysTeachHonoraryAchievement> selectSysTeachHonoraryAchievementList(SysTeachHonoraryAchievement sysTeachHonoraryAchievement) {
        return sysTeachHonoraryAchievementMapper.selectSysTeachHonoraryAchievementList(sysTeachHonoraryAchievement);
    }

    /**
     * 新增幼儿园教职工与荣誉成果关联
     *
     * @param sysTeachHonoraryAchievement 幼儿园教职工与荣誉成果关联
     * @return 结果
     */

    @Override
    public int insertSysTeachHonoraryAchievement(SysTeachHonoraryAchievement sysTeachHonoraryAchievement) {
        return sysTeachHonoraryAchievementMapper.insert(sysTeachHonoraryAchievement);
    }

    /**
     * 修改幼儿园教职工与荣誉成果关联
     *
     * @param sysTeachHonoraryAchievement 幼儿园教职工与荣誉成果关联
     * @return 结果
     */
    @Override
    public int updateSysTeachHonoraryAchievement(SysTeachHonoraryAchievement sysTeachHonoraryAchievement) {
        return sysTeachHonoraryAchievementMapper.updateById(sysTeachHonoraryAchievement);
    }

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

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

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