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.TcSjlytjMapper;
import com.ruoyi.tcZz.domain.TcSjlytj;
import com.ruoyi.tcZz.service.ITcSjlytjService;

/**
 * 数据来源统计Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcSjlytjServiceImpl implements ITcSjlytjService 
{
    @Autowired
    private TcSjlytjMapper tcSjlytjMapper;

    /**
     * 查询数据来源统计
     * 
     * @param id 数据来源统计主键
     * @return 数据来源统计
     */
    @Override
    public TcSjlytj selectTcSjlytjById(Long id)
    {
        return tcSjlytjMapper.selectTcSjlytjById(id);
    }

    /**
     * 查询数据来源统计列表
     * 
     * @param tcSjlytj 数据来源统计
     * @return 数据来源统计
     */
    @Override
    public List<TcSjlytj> selectTcSjlytjList(TcSjlytj tcSjlytj)
    {
        return tcSjlytjMapper.selectTcSjlytjList(tcSjlytj);
    }

    /**
     * 新增数据来源统计
     * 
     * @param tcSjlytj 数据来源统计
     * @return 结果
     */
    @Override
    public int insertTcSjlytj(TcSjlytj tcSjlytj)
    {
        tcSjlytj.setCreateTime(DateUtils.getNowDate());
        return tcSjlytjMapper.insertTcSjlytj(tcSjlytj);
    }

    /**
     * 修改数据来源统计
     * 
     * @param tcSjlytj 数据来源统计
     * @return 结果
     */
    @Override
    public int updateTcSjlytj(TcSjlytj tcSjlytj)
    {
        tcSjlytj.setUpdateTime(DateUtils.getNowDate());
        return tcSjlytjMapper.updateTcSjlytj(tcSjlytj);
    }

    /**
     * 批量删除数据来源统计
     * 
     * @param ids 需要删除的数据来源统计主键
     * @return 结果
     */
    @Override
    public int deleteTcSjlytjByIds(Long[] ids)
    {
        return tcSjlytjMapper.deleteTcSjlytjByIds(ids);
    }

    /**
     * 删除数据来源统计信息
     * 
     * @param id 数据来源统计主键
     * @return 结果
     */
    @Override
    public int deleteTcSjlytjById(Long id)
    {
        return tcSjlytjMapper.deleteTcSjlytjById(id);
    }

    @Override
    public String importUser(List<TcSjlytj> tcSjlytjList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcSjlytjList.isEmpty()) {
            for (TcSjlytj tcSjlytj : tcSjlytjList) {
                tcSjlytjMapper.insertTcSjlytj(tcSjlytj);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

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