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.TcVxMapper;
import com.ruoyi.tcZz.domain.TcVx;
import com.ruoyi.tcZz.service.ITcVxService;

/**
 * 微信Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcVxServiceImpl implements ITcVxService 
{
    @Autowired
    private TcVxMapper tcVxMapper;

    /**
     * 查询微信
     * 
     * @param id 微信主键
     * @return 微信
     */
    @Override
    public TcVx selectTcVxById(Long id)
    {
        return tcVxMapper.selectTcVxById(id);
    }

    /**
     * 查询微信列表
     * 
     * @param tcVx 微信
     * @return 微信
     */
    @Override
    public List<TcVx> selectTcVxList(TcVx tcVx)
    {
        return tcVxMapper.selectTcVxList(tcVx);
    }

    /**
     * 新增微信
     * 
     * @param tcVx 微信
     * @return 结果
     */
    @Override
    public int insertTcVx(TcVx tcVx)
    {
        tcVx.setCreateTime(DateUtils.getNowDate());
        return tcVxMapper.insertTcVx(tcVx);
    }

    /**
     * 修改微信
     * 
     * @param tcVx 微信
     * @return 结果
     */
    @Override
    public int updateTcVx(TcVx tcVx)
    {
        tcVx.setUpdateTime(DateUtils.getNowDate());
        return tcVxMapper.updateTcVx(tcVx);
    }

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

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

    @Override
    public String importUser(List<TcVx> tcVxList) {

        StringBuilder successMsg = new StringBuilder();
        if (!tcVxList.isEmpty()) {
            for (TcVx tcVx : tcVxList) {
                tcVxMapper.insertTcVx(tcVx);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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