package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcVx;
import com.ruoyi.tcZz.domain.TcWljgtj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcYqyjMapper;
import com.ruoyi.tcZz.domain.TcYqyj;
import com.ruoyi.tcZz.service.ITcYqyjService;

/**
 * 舆情预警Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcYqyjServiceImpl implements ITcYqyjService 
{
    @Autowired
    private TcYqyjMapper tcYqyjMapper;

    /**
     * 查询舆情预警
     * 
     * @param id 舆情预警主键
     * @return 舆情预警
     */
    @Override
    public TcYqyj selectTcYqyjById(Long id)
    {
        return tcYqyjMapper.selectTcYqyjById(id);
    }

    /**
     * 查询舆情预警列表
     * 
     * @param tcYqyj 舆情预警
     * @return 舆情预警
     */
    @Override
    public List<TcYqyj> selectTcYqyjList(TcYqyj tcYqyj)
    {
        return tcYqyjMapper.selectTcYqyjList(tcYqyj);
    }

    /**
     * 新增舆情预警
     * 
     * @param tcYqyj 舆情预警
     * @return 结果
     */
    @Override
    public int insertTcYqyj(TcYqyj tcYqyj)
    {
        tcYqyj.setCreateTime(DateUtils.getNowDate());
        return tcYqyjMapper.insertTcYqyj(tcYqyj);
    }

    /**
     * 修改舆情预警
     * 
     * @param tcYqyj 舆情预警
     * @return 结果
     */
    @Override
    public int updateTcYqyj(TcYqyj tcYqyj)
    {
        tcYqyj.setUpdateTime(DateUtils.getNowDate());
        return tcYqyjMapper.updateTcYqyj(tcYqyj);
    }

    /**
     * 批量删除舆情预警
     * 
     * @param ids 需要删除的舆情预警主键
     * @return 结果
     */
    @Override
    public int deleteTcYqyjByIds(Long[] ids)
    {
        return tcYqyjMapper.deleteTcYqyjByIds(ids);
    }

    /**
     * 删除舆情预警信息
     * 
     * @param id 舆情预警主键
     * @return 结果
     */
    @Override
    public int deleteTcYqyjById(Long id)
    {
        return tcYqyjMapper.deleteTcYqyjById(id);
    }


    @Override
    public String importUser(List<TcYqyj> tcYqyjList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcYqyjList.isEmpty()) {
            for (TcYqyj tcYqyj : tcYqyjList) {
                tcYqyjMapper.insertTcYqyj(tcYqyj);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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


}
