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.TcWbMapper;
import com.ruoyi.tcZz.domain.TcWb;
import com.ruoyi.tcZz.service.ITcWbService;

/**
 * 微博Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcWbServiceImpl implements ITcWbService 
{
    @Autowired
    private TcWbMapper tcWbMapper;

    /**
     * 查询微博
     * 
     * @param id 微博主键
     * @return 微博
     */
    @Override
    public TcWb selectTcWbById(Long id)
    {
        return tcWbMapper.selectTcWbById(id);
    }

    /**
     * 查询微博列表
     * 
     * @param tcWb 微博
     * @return 微博
     */
    @Override
    public List<TcWb> selectTcWbList(TcWb tcWb)
    {
        return tcWbMapper.selectTcWbList(tcWb);
    }

    /**
     * 新增微博
     * 
     * @param tcWb 微博
     * @return 结果
     */
    @Override
    public int insertTcWb(TcWb tcWb)
    {
        tcWb.setCreateTime(DateUtils.getNowDate());
        return tcWbMapper.insertTcWb(tcWb);
    }

    /**
     * 修改微博
     * 
     * @param tcWb 微博
     * @return 结果
     */
    @Override
    public int updateTcWb(TcWb tcWb)
    {
        tcWb.setUpdateTime(DateUtils.getNowDate());
        return tcWbMapper.updateTcWb(tcWb);
    }

    /**
     * 批量删除微博
     * 
     * @param ids 需要删除的微博主键
     * @return 结果
     */
    @Override
    public int deleteTcWbByIds(Long[] ids)
    {
        return tcWbMapper.deleteTcWbByIds(ids);
    }

    /**
     * 删除微博信息
     * 
     * @param id 微博主键
     * @return 结果
     */
    @Override
    public int deleteTcWbById(Long id)
    {
        return tcWbMapper.deleteTcWbById(id);
    }

    @Override
    public String importUser(List<TcWb> tcWbList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcWbList.isEmpty()) {
            for (TcWb tcWb : tcWbList) {
                tcWbMapper.insertTcWb(tcWb);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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