package com.ruoyi.zongzhi.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.zongzhi.mapper.TcDataSourceMapper;
import com.ruoyi.zongzhi.domain.TcDataSource;
import com.ruoyi.zongzhi.service.ITcDataSourceService;

/**
 * 数据来源Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-10
 */
@Service
public class TcDataSourceServiceImpl implements ITcDataSourceService 
{
    @Autowired
    private TcDataSourceMapper tcDataSourceMapper;

    /**
     * 查询数据来源
     * 
     * @param id 数据来源主键
     * @return 数据来源
     */
    @Override
    public TcDataSource selectTcDataSourceById(Long id)
    {
        return tcDataSourceMapper.selectTcDataSourceById(id);
    }

    /**
     * 查询数据来源列表
     * 
     * @param tcDataSource 数据来源
     * @return 数据来源
     */
    @Override
    public List<TcDataSource> selectTcDataSourceList(TcDataSource tcDataSource)
    {
        return tcDataSourceMapper.selectTcDataSourceList(tcDataSource);
    }

    /**
     * 新增数据来源
     * 
     * @param tcDataSource 数据来源
     * @return 结果
     */
    @Override
    public int insertTcDataSource(TcDataSource tcDataSource)
    {
        tcDataSource.setCreateTime(DateUtils.getNowDate());
        return tcDataSourceMapper.insertTcDataSource(tcDataSource);
    }

    /**
     * 修改数据来源
     * 
     * @param tcDataSource 数据来源
     * @return 结果
     */
    @Override
    public int updateTcDataSource(TcDataSource tcDataSource)
    {
        tcDataSource.setUpdateTime(DateUtils.getNowDate());
        return tcDataSourceMapper.updateTcDataSource(tcDataSource);
    }

    /**
     * 批量删除数据来源
     * 
     * @param ids 需要删除的数据来源主键
     * @return 结果
     */
    @Override
    public int deleteTcDataSourceByIds(Long[] ids)
    {
        return tcDataSourceMapper.deleteTcDataSourceByIds(ids);
    }

    /**
     * 删除数据来源信息
     * 
     * @param id 数据来源主键
     * @return 结果
     */
    @Override
    public int deleteTcDataSourceById(Long id)
    {
        return tcDataSourceMapper.deleteTcDataSourceById(id);
    }
}
