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.TcFbMapper;
import com.ruoyi.tcZz.domain.TcFb;
import com.ruoyi.tcZz.service.ITcFbService;

/**
 * 上级媒体、本地发布Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcFbServiceImpl implements ITcFbService 
{
    @Autowired
    private TcFbMapper tcFbMapper;

    /**
     * 查询上级媒体、本地发布
     * 
     * @param id 上级媒体、本地发布主键
     * @return 上级媒体、本地发布
     */
    @Override
    public TcFb selectTcFbById(Long id)
    {
        return tcFbMapper.selectTcFbById(id);
    }

    /**
     * 查询上级媒体、本地发布列表
     * 
     * @param tcFb 上级媒体、本地发布
     * @return 上级媒体、本地发布
     */
    @Override
    public List<TcFb> selectTcFbList(TcFb tcFb)
    {
        return tcFbMapper.selectTcFbList(tcFb);
    }

    /**
     * 新增上级媒体、本地发布
     * 
     * @param tcFb 上级媒体、本地发布
     * @return 结果
     */
    @Override
    public int insertTcFb(TcFb tcFb)
    {
        tcFb.setCreateTime(DateUtils.getNowDate());
        return tcFbMapper.insertTcFb(tcFb);
    }

    /**
     * 修改上级媒体、本地发布
     * 
     * @param tcFb 上级媒体、本地发布
     * @return 结果
     */
    @Override
    public int updateTcFb(TcFb tcFb)
    {
        tcFb.setUpdateTime(DateUtils.getNowDate());
        return tcFbMapper.updateTcFb(tcFb);
    }

    /**
     * 批量删除上级媒体、本地发布
     * 
     * @param ids 需要删除的上级媒体、本地发布主键
     * @return 结果
     */
    @Override
    public int deleteTcFbByIds(Long[] ids)
    {
        return tcFbMapper.deleteTcFbByIds(ids);
    }

    /**
     * 删除上级媒体、本地发布信息
     * 
     * @param id 上级媒体、本地发布主键
     * @return 结果
     */
    @Override
    public int deleteTcFbById(Long id)
    {
        return tcFbMapper.deleteTcFbById(id);
    }

    @Override
    public String importUser(List<TcFb> tccFbList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tccFbList.isEmpty()) {
            for (TcFb tcFb : tccFbList) {
                tcFbMapper.insertTcFb(tcFb);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

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