package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcAqg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcTtsumMapper;
import com.ruoyi.tcZz.domain.TcTtsum;
import com.ruoyi.tcZz.service.ITcTtsumService;

/**
 * 今日头条、快手Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcTtsumServiceImpl implements ITcTtsumService 
{
    @Autowired
    private TcTtsumMapper tcTtsumMapper;

    /**
     * 查询今日头条、快手
     * 
     * @param id 今日头条、快手主键
     * @return 今日头条、快手
     */
    @Override
    public TcTtsum selectTcTtsumById(Long id)
    {
        return tcTtsumMapper.selectTcTtsumById(id);
    }

    /**
     * 查询今日头条、快手列表
     * 
     * @param tcTtsum 今日头条、快手
     * @return 今日头条、快手
     */
    @Override
    public List<TcTtsum> selectTcTtsumList(TcTtsum tcTtsum)
    {
        return tcTtsumMapper.selectTcTtsumList(tcTtsum);
    }

    /**
     * 新增今日头条、快手
     * 
     * @param tcTtsum 今日头条、快手
     * @return 结果
     */
    @Override
    public int insertTcTtsum(TcTtsum tcTtsum)
    {
        tcTtsum.setCreateTime(DateUtils.getNowDate());
        return tcTtsumMapper.insertTcTtsum(tcTtsum);
    }

    /**
     * 修改今日头条、快手
     * 
     * @param tcTtsum 今日头条、快手
     * @return 结果
     */
    @Override
    public int updateTcTtsum(TcTtsum tcTtsum)
    {
        tcTtsum.setUpdateTime(DateUtils.getNowDate());
        return tcTtsumMapper.updateTcTtsum(tcTtsum);
    }

    /**
     * 批量删除今日头条、快手
     * 
     * @param ids 需要删除的今日头条、快手主键
     * @return 结果
     */
    @Override
    public int deleteTcTtsumByIds(Long[] ids)
    {
        return tcTtsumMapper.deleteTcTtsumByIds(ids);
    }

    /**
     * 删除今日头条、快手信息
     * 
     * @param id 今日头条、快手主键
     * @return 结果
     */
    @Override
    public int deleteTcTtsumById(Long id)
    {
        return tcTtsumMapper.deleteTcTtsumById(id);
    }

    @Override
    public String importUser(List<TcTtsum> tcTtsumList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcTtsumList.isEmpty()) {
            for (TcTtsum tcTtsum : tcTtsumList) {
                tcTtsumMapper.insertTcTtsum(tcTtsum);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

    @Override
    public void updateByisStatus(Integer isStatus,List<String> ids) {
        tcTtsumMapper.updateByisStatus(isStatus,ids);
    }
}
