package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcWljg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcDyMapper;
import com.ruoyi.tcZz.domain.TcDy;
import com.ruoyi.tcZz.service.ITcDyService;

/**
 * 抖音Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcDyServiceImpl implements ITcDyService 
{
    @Autowired
    private TcDyMapper tcDyMapper;

    /**
     * 查询抖音
     * 
     * @param id 抖音主键
     * @return 抖音
     */
    @Override
    public TcDy selectTcDyById(Long id)
    {
        return tcDyMapper.selectTcDyById(id);
    }

    /**
     * 查询抖音列表
     * 
     * @param tcDy 抖音
     * @return 抖音
     */
    @Override
    public List<TcDy> selectTcDyList(TcDy tcDy)
    {
        return tcDyMapper.selectTcDyList(tcDy);
    }

    /**
     * 新增抖音
     * 
     * @param tcDy 抖音
     * @return 结果
     */
    @Override
    public int insertTcDy(TcDy tcDy)
    {
        tcDy.setCreateTime(DateUtils.getNowDate());
        return tcDyMapper.insertTcDy(tcDy);
    }

    /**
     * 修改抖音
     * 
     * @param tcDy 抖音
     * @return 结果
     */
    @Override
    public int updateTcDy(TcDy tcDy)
    {
        tcDy.setUpdateTime(DateUtils.getNowDate());
        return tcDyMapper.updateTcDy(tcDy);
    }

    /**
     * 批量删除抖音
     * 
     * @param ids 需要删除的抖音主键
     * @return 结果
     */
    @Override
    public int deleteTcDyByIds(Long[] ids)
    {
        return tcDyMapper.deleteTcDyByIds(ids);
    }

    /**
     * 删除抖音信息
     * 
     * @param id 抖音主键
     * @return 结果
     */
    @Override
    public int deleteTcDyById(Long id)
    {
        return tcDyMapper.deleteTcDyById(id);
    }

    @Override
    public String importUser(List<TcDy> tcDyList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcDyList.isEmpty()) {
            for (TcDy tcDy : tcDyList) {
                tcDyMapper.insertTcDy(tcDy);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

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