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.TcCyMapper;
import com.ruoyi.tcZz.domain.TcCy;
import com.ruoyi.tcZz.service.ITcCyService;

/**
 * 词云Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcCyServiceImpl implements ITcCyService 
{
    @Autowired
    private TcCyMapper tcCyMapper;

    /**
     * 查询词云
     * 
     * @param id 词云主键
     * @return 词云
     */
    @Override
    public TcCy selectTcCyById(Long id)
    {
        return tcCyMapper.selectTcCyById(id);
    }

    /**
     * 查询词云列表
     * 
     * @param tcCy 词云
     * @return 词云
     */
    @Override
    public List<TcCy> selectTcCyList(TcCy tcCy)
    {
        return tcCyMapper.selectTcCyList(tcCy);
    }

    /**
     * 新增词云
     * 
     * @param tcCy 词云
     * @return 结果
     */
    @Override
    public int insertTcCy(TcCy tcCy)
    {
        tcCy.setCreateTime(DateUtils.getNowDate());
        return tcCyMapper.insertTcCy(tcCy);
    }

    /**
     * 修改词云
     * 
     * @param tcCy 词云
     * @return 结果
     */
    @Override
    public int updateTcCy(TcCy tcCy)
    {
        tcCy.setUpdateTime(DateUtils.getNowDate());
        return tcCyMapper.updateTcCy(tcCy);
    }

    /**
     * 批量删除词云
     * 
     * @param ids 需要删除的词云主键
     * @return 结果
     */
    @Override
    public int deleteTcCyByIds(Long[] ids)
    {
        return tcCyMapper.deleteTcCyByIds(ids);
    }

    /**
     * 删除词云信息
     * 
     * @param id 词云主键
     * @return 结果
     */
    @Override
    public int deleteTcCyById(Long id)
    {
        return tcCyMapper.deleteTcCyById(id);
    }

    @Override
    public String importUser(List<TcCy> tcCyList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcCyList.isEmpty()) {
            for (TcCy tcCy : tcCyList) {
                tcCyMapper.insertTcCy(tcCy);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }
    @Override
    public void updateByisStatus(Integer isStatus,List<String> ids) {
        tcCyMapper.updateByisStatus(isStatus,ids);
    }
}
