package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.TrainingMapper;
import com.ruoyi.model.domain.Training;
import com.ruoyi.model.service.ITrainingService;

/**
 * 考核培训Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@Service
public class TrainingServiceImpl implements ITrainingService 
{
    @Autowired
    private TrainingMapper trainingMapper;

    /**
     * 查询考核培训
     * 
     * @param trainingId 考核培训主键
     * @return 考核培训
     */
    @Override
    public Training selectTrainingByTrainingId(Long trainingId)
    {
        return trainingMapper.selectTrainingByTrainingId(trainingId);
    }

    /**
     * 查询考核培训列表
     * 
     * @param training 考核培训
     * @return 考核培训
     */
    @Override
    public List<Training> selectTrainingList(Training training)
    {
        return trainingMapper.selectTrainingList(training);
    }

    /**
     * 新增考核培训
     * 
     * @param training 考核培训
     * @return 结果
     */
    @Override
    public int insertTraining(Training training)
    {
        training.setCreateTime(DateUtils.getNowDate());
        return trainingMapper.insertTraining(training);
    }

    /**
     * 修改考核培训
     * 
     * @param training 考核培训
     * @return 结果
     */
    @Override
    public int updateTraining(Training training)
    {
        training.setUpdateTime(DateUtils.getNowDate());
        return trainingMapper.updateTraining(training);
    }

    /**
     * 批量删除考核培训
     * 
     * @param trainingIds 需要删除的考核培训主键
     * @return 结果
     */
    @Override
    public int deleteTrainingByTrainingIds(Long[] trainingIds)
    {
        return trainingMapper.deleteTrainingByTrainingIds(trainingIds);
    }

    /**
     * 删除考核培训信息
     * 
     * @param trainingId 考核培训主键
     * @return 结果
     */
    @Override
    public int deleteTrainingByTrainingId(Long trainingId)
    {
        return trainingMapper.deleteTrainingByTrainingId(trainingId);
    }

    @Override
    public List<Training> getTrainingList() {
        return trainingMapper.getTrainingList();
    }
}
