package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcWljgtj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcYqbgMapper;
import com.ruoyi.tcZz.domain.TcYqbg;
import com.ruoyi.tcZz.service.ITcYqbgService;

/**
 * 舆情报告Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcYqbgServiceImpl implements ITcYqbgService 
{
    @Autowired
    private TcYqbgMapper tcYqbgMapper;

    /**
     * 查询舆情报告
     * 
     * @param id 舆情报告主键
     * @return 舆情报告
     */
    @Override
    public TcYqbg selectTcYqbgById(Long id)
    {
        return tcYqbgMapper.selectTcYqbgById(id);
    }

    /**
     * 查询舆情报告列表
     * 
     * @param tcYqbg 舆情报告
     * @return 舆情报告
     */
    @Override
    public List<TcYqbg> selectTcYqbgList(TcYqbg tcYqbg)
    {
        return tcYqbgMapper.selectTcYqbgList(tcYqbg);
    }

    /**
     * 新增舆情报告
     * 
     * @param tcYqbg 舆情报告
     * @return 结果
     */
    @Override
    public int insertTcYqbg(TcYqbg tcYqbg)
    {
        tcYqbg.setCreateTime(DateUtils.getNowDate());
        return tcYqbgMapper.insertTcYqbg(tcYqbg);
    }

    /**
     * 修改舆情报告
     * 
     * @param tcYqbg 舆情报告
     * @return 结果
     */
    @Override
    public int updateTcYqbg(TcYqbg tcYqbg)
    {
        tcYqbg.setUpdateTime(DateUtils.getNowDate());
        return tcYqbgMapper.updateTcYqbg(tcYqbg);
    }

    /**
     * 批量删除舆情报告
     * 
     * @param ids 需要删除的舆情报告主键
     * @return 结果
     */
    @Override
    public int deleteTcYqbgByIds(Long[] ids)
    {
        return tcYqbgMapper.deleteTcYqbgByIds(ids);
    }

    /**
     * 删除舆情报告信息
     * 
     * @param id 舆情报告主键
     * @return 结果
     */
    @Override
    public int deleteTcYqbgById(Long id)
    {
        return tcYqbgMapper.deleteTcYqbgById(id);
    }

    @Override
    public String importUser(List<TcYqbg> tcYqbgList) {
            StringBuilder successMsg = new StringBuilder();
            if (!tcYqbgList.isEmpty()) {
                for (TcYqbg tcYqbg : tcYqbgList) {
                    tcYqbgMapper.insertTcYqbg(tcYqbg);
                }
                successMsg.append("导入成功");
            }
            return successMsg.toString();
        }

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