package com.ruoyi.project.training.elearn.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.project.training.elearn.mapper.TElLearnMapper;
import com.ruoyi.project.training.elearn.domain.TElLearn;
import com.ruoyi.project.training.elearn.service.ITElLearnService;

/**
 * 在线学习记录Service业务层处理
 *
 * @author ssy
 * @date 2024-06-05
 */
@Service
public class TElLearnServiceImpl implements ITElLearnService
{
    @Autowired
    private TElLearnMapper tElLearnMapper;

    /**
     * 查询在线学习记录
     *
     * @param id 在线学习记录ID
     * @return 在线学习记录
     */
    @Override
    public TElLearn selectTElLearnById(Long id)
    {
        return tElLearnMapper.selectTElLearnById(id);
    }

    /**
     * 查询在线学习记录列表
     *
     * @param tElLearn 在线学习记录
     * @return 在线学习记录
     */
    @Override
    public List<TElLearn> selectTElLearnList(TElLearn tElLearn)
    {
        return tElLearnMapper.selectTElLearnList(tElLearn);
    }

    public TElLearn selectLearnByUserIdAndResourceId(TElLearn tElLearn)
    {
        return tElLearnMapper.selectLearnByUserIdAndResourceId(tElLearn);
    }

    /**
     * 新增在线学习记录
     *
     * @param tElLearn 在线学习记录
     * @return 结果
     */
    @Override
    public int insertTElLearn(TElLearn tElLearn)
    {
        tElLearn.setCreateTime(DateUtils.getNowDate());
        return tElLearnMapper.insertTElLearn(tElLearn);
    }

    /**
     * 修改在线学习记录
     *
     * @param tElLearn 在线学习记录
     * @return 结果
     */
    @Override
    public int updateTElLearn(TElLearn tElLearn)
    {
        tElLearn.setUpdateTime(DateUtils.getNowDate());
        return tElLearnMapper.updateTElLearn(tElLearn);
    }

    /**
     * 批量删除在线学习记录
     *
     * @param ids 需要删除的在线学习记录ID
     * @return 结果
     */
    @Override
    public int deleteTElLearnByIds(Long[] ids)
    {
        return tElLearnMapper.deleteTElLearnByIds(ids);
    }

    /**
     * 删除在线学习记录信息
     *
     * @param id 在线学习记录ID
     * @return 结果
     */
    @Override
    public int deleteTElLearnById(Long id)
    {
        return tElLearnMapper.deleteTElLearnById(id);
    }
}
