package com.xinelu.manage.service.trainingitemplayrecord.Impl;

import com.xinelu.manage.domain.trainingitemplayrecord.TrainingItemPlayRecord;
import com.xinelu.manage.mapper.trainingitemplayrecord.TrainingItemPlayRecordMapper;
import com.xinelu.manage.service.trainingitemplayrecord.ITrainingItemPlayRecordService;
import com.xinelu.manage.vo.trainingitemplayrecord.TrainingItemPlayRecordVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;


/**
 * 学习培训项目播放日志记录Service业务层处理
 *
 * @author xinyilu
 * @date 2023-04-20
 */
@Service
public class TrainingItemPlayRecordServiceImpl implements ITrainingItemPlayRecordService {
    @Resource
    private TrainingItemPlayRecordMapper trainingItemPlayRecordMapper;

    /**
     * 查询学习培训项目播放日志记录
     *
     * @param id 学习培训项目播放日志记录主键
     * @return 学习培训项目播放日志记录
     */
    @Override
    public TrainingItemPlayRecord selectTrainingItemPlayRecordById(Long id) {
        return trainingItemPlayRecordMapper.selectTrainingItemPlayRecordById(id);
    }

    /**
     * 查询学习培训项目播放日志记录列表
     *
     * @param trainingItemPlayRecord 学习培训项目播放日志记录
     * @return 学习培训项目播放日志记录
     */
    @Override
    public List<TrainingItemPlayRecord> selectTrainingItemPlayRecordList(TrainingItemPlayRecord trainingItemPlayRecord) {
        return trainingItemPlayRecordMapper.selectTrainingItemPlayRecordList(trainingItemPlayRecord);
    }

    /**
     * 新增学习培训项目播放日志记录
     *
     * @param trainingItemPlayRecord 学习培训项目播放日志记录
     * @return 结果
     */
    @Override
    public int insertTrainingItemPlayRecord(TrainingItemPlayRecord trainingItemPlayRecord) {
        trainingItemPlayRecord.setCreateTime(LocalDateTime.now());
        return trainingItemPlayRecordMapper.insertTrainingItemPlayRecord(trainingItemPlayRecord);
    }

    /**
     * 修改学习培训项目播放日志记录
     *
     * @param trainingItemPlayRecord 学习培训项目播放日志记录
     * @return 结果
     */
    @Override
    public int updateTrainingItemPlayRecord(TrainingItemPlayRecord trainingItemPlayRecord) {
        trainingItemPlayRecord.setUpdateTime(LocalDateTime.now());
        return trainingItemPlayRecordMapper.updateTrainingItemPlayRecord(trainingItemPlayRecord);
    }

    /**
     * 批量删除学习培训项目播放日志记录
     *
     * @param ids 需要删除的学习培训项目播放日志记录主键
     * @return 结果
     */
    @Override
    public int deleteTrainingItemPlayRecordByIds(Long[] ids) {
        return trainingItemPlayRecordMapper.deleteTrainingItemPlayRecordByIds(ids);
    }

    /**
     * 查询学习培训项目播放日志记录列表数量
     *
     * @param trainingItemPlayRecord 学习培训项目播放日志记录
     * @return 学习培训项目播放日志记录集合
     */
    @Override
    public List<TrainingItemPlayRecordVO> getTrainingItemPlayRecordList(TrainingItemPlayRecord trainingItemPlayRecord) {
        return trainingItemPlayRecordMapper.getTrainingItemPlayRecordList(trainingItemPlayRecord);
    }
}