package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcWljgtj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcWpyMapper;
import com.ruoyi.tcZz.domain.TcWpy;
import com.ruoyi.tcZz.service.ITcWpyService;

/**
 * 网评员Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcWpyServiceImpl implements ITcWpyService 
{
    @Autowired
    private TcWpyMapper tcWpyMapper;

    /**
     * 查询网评员
     * 
     * @param id 网评员主键
     * @return 网评员
     */
    @Override
    public TcWpy selectTcWpyById(Long id)
    {
        return tcWpyMapper.selectTcWpyById(id);
    }

    /**
     * 查询网评员列表
     * 
     * @param tcWpy 网评员
     * @return 网评员
     */
    @Override
    public List<TcWpy> selectTcWpyList(TcWpy tcWpy)
    {
        return tcWpyMapper.selectTcWpyList(tcWpy);
    }

    /**
     * 新增网评员
     * 
     * @param tcWpy 网评员
     * @return 结果
     */
    @Override
    public int insertTcWpy(TcWpy tcWpy)
    {
        tcWpy.setCreateTime(DateUtils.getNowDate());
        return tcWpyMapper.insertTcWpy(tcWpy);
    }

    /**
     * 修改网评员
     * 
     * @param tcWpy 网评员
     * @return 结果
     */
    @Override
    public int updateTcWpy(TcWpy tcWpy)
    {
        tcWpy.setUpdateTime(DateUtils.getNowDate());
        return tcWpyMapper.updateTcWpy(tcWpy);
    }

    /**
     * 批量删除网评员
     * 
     * @param ids 需要删除的网评员主键
     * @return 结果
     */
    @Override
    public int deleteTcWpyByIds(Long[] ids)
    {
        return tcWpyMapper.deleteTcWpyByIds(ids);
    }

    /**
     * 删除网评员信息
     * 
     * @param id 网评员主键
     * @return 结果
     */
    @Override
    public int deleteTcWpyById(Long id)
    {
        return tcWpyMapper.deleteTcWpyById(id);
    }

    @Override
    public String importUser(List<TcWpy> tcWpyList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcWpyList.isEmpty()) {
            for (TcWpy tcWpy : tcWpyList) {
                tcWpyMapper.insertTcWpy(tcWpy);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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

}
