package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcWljgMapper;
import com.ruoyi.tcZz.domain.TcWljg;
import com.ruoyi.tcZz.service.ITcWljgService;

/**
 * 网络监测Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcWljgServiceImpl implements ITcWljgService 
{
    @Autowired
    private TcWljgMapper tcWljgMapper;

    /**
     * 查询网络监测
     *
     * @param id 网络监测主键
     * @return 网络监测
     */
    @Override
    public TcWljg selectTcWljgById(Long id)
    {
        return tcWljgMapper.selectTcWljgById(id);
    }

    /**
     * 查询网络监测列表
     * 
     * @param tcWljg 网络监测
     * @return 网络监测
     */
    @Override
    public List<TcWljg> selectTcWljgList(TcWljg tcWljg)
    {
        return tcWljgMapper.selectTcWljgList(tcWljg);
    }

    /**
     * 新增网络监测
     * 
     * @param tcWljg 网络监测
     * @return 结果
     */
    @Override
    public int insertTcWljg(TcWljg tcWljg)
    {
        tcWljg.setCreateTime(DateUtils.getNowDate());
        return tcWljgMapper.insertTcWljg(tcWljg);
    }

    /**
     * 修改网络监测
     * 
     * @param tcWljg 网络监测
     * @return 结果
     */
    @Override
    public int updateTcWljg(TcWljg tcWljg)
    {

        return tcWljgMapper.updateTcWljg(tcWljg);
    }

    /**
     * 批量删除网络监测
     * 
     * @param ids 需要删除的网络监测主键
     * @return 结果
     */
    @Override
    public int deleteTcWljgByIds(Long[] ids)
    {
        return tcWljgMapper.deleteTcWljgByIds(ids);
    }

    /**
     * 删除网络监测信息
     * 
     * @param id 网络监测主键
     * @return 结果
     */
    @Override
    public int deleteTcWljgById(Long id)
    {
        return tcWljgMapper.deleteTcWljgById(id);
    }

    @Override
    public String importUser(List<TcWljg> tcWljgList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcWljgList.isEmpty()) {
            for (TcWljg tcWljg : tcWljgList) {
                tcWljgMapper.insertTcWljg(tcWljg);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

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