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.TcWlwmzyzMapper;
import com.ruoyi.tcZz.domain.TcWlwmzyz;
import com.ruoyi.tcZz.service.ITcWlwmzyzService;

/**
 * 网络文明志愿者Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcWlwmzyzServiceImpl implements ITcWlwmzyzService {
    @Autowired
    private TcWlwmzyzMapper tcWlwmzyzMapper;

    /**
     * 查询网络文明志愿者
     *
     * @param id 网络文明志愿者主键
     * @return 网络文明志愿者
     */
    @Override
    public TcWlwmzyz selectTcWlwmzyzById(Long id) {
        return tcWlwmzyzMapper.selectTcWlwmzyzById(id);
    }

    /**
     * 查询网络文明志愿者列表
     *
     * @param tcWlwmzyz 网络文明志愿者
     * @return 网络文明志愿者
     */
    @Override
    public List<TcWlwmzyz> selectTcWlwmzyzList(TcWlwmzyz tcWlwmzyz) {
        return tcWlwmzyzMapper.selectTcWlwmzyzList(tcWlwmzyz);
    }

    /**
     * 新增网络文明志愿者
     *
     * @param tcWlwmzyz 网络文明志愿者
     * @return 结果
     */
    @Override
    public int insertTcWlwmzyz(TcWlwmzyz tcWlwmzyz) {
        tcWlwmzyz.setCreateTime(DateUtils.getNowDate());
        return tcWlwmzyzMapper.insertTcWlwmzyz(tcWlwmzyz);
    }

    /**
     * 修改网络文明志愿者
     *
     * @param tcWlwmzyz 网络文明志愿者
     * @return 结果
     */
    @Override
    public int updateTcWlwmzyz(TcWlwmzyz tcWlwmzyz) {
        tcWlwmzyz.setUpdateTime(DateUtils.getNowDate());
        return tcWlwmzyzMapper.updateTcWlwmzyz(tcWlwmzyz);
    }

    /**
     * 批量删除网络文明志愿者
     *
     * @param ids 需要删除的网络文明志愿者主键
     * @return 结果
     */
    @Override
    public int deleteTcWlwmzyzByIds(Long[] ids) {
        return tcWlwmzyzMapper.deleteTcWlwmzyzByIds(ids);
    }

    /**
     * 删除网络文明志愿者信息
     *
     * @param id 网络文明志愿者主键
     * @return 结果
     */
    @Override
    public int deleteTcWlwmzyzById(Long id) {
        return tcWlwmzyzMapper.deleteTcWlwmzyzById(id);
    }

    @Override
    public String importUser(List<TcWlwmzyz> tcWlwmzyzList) {

        StringBuilder successMsg = new StringBuilder();
        if (!tcWlwmzyzList.isEmpty()) {
            for (TcWlwmzyz tcWlwmzyz : tcWlwmzyzList) {
                tcWlwmzyzMapper.insertTcWlwmzyz(tcWlwmzyz);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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

}
