package com.ruoyi.tcZz.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcSjly;
import com.ruoyi.tcZz.mapper.TcSjlyMapper;
import com.ruoyi.tcZz.service.ITcSjlyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 硬探针、软探针Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcSjlyServiceImpl implements ITcSjlyService {
    @Autowired
    private TcSjlyMapper tcSjlyMapper;

    /**
     * 查询硬探针、软探针
     *
     * @param id 硬探针、软探针主键
     * @return 硬探针、软探针
     */
    @Override
    public TcSjly selectTcSjlyById(Long id) {
        return tcSjlyMapper.selectTcSjlyById(id);
    }

    /**
     * 查询硬探针、软探针列表
     *
     * @param tcSjly 硬探针、软探针
     * @return 硬探针、软探针
     */
    @Override
    public List<TcSjly> selectTcSjlyList(TcSjly tcSjly) {
        return tcSjlyMapper.selectTcSjlyList(tcSjly);
    }

    /**
     * 新增硬探针、软探针
     *
     * @param tcSjly 硬探针、软探针
     * @return 结果
     */
    @Override
    public int insertTcSjly(TcSjly tcSjly) {
        tcSjly.setCreateTime(DateUtils.getNowDate());
        return tcSjlyMapper.insertTcSjly(tcSjly);
    }

    /**
     * 修改硬探针、软探针
     *
     * @param tcSjly 硬探针、软探针
     * @return 结果
     */
    @Override
    public int updateTcSjly(TcSjly tcSjly) {
        tcSjly.setUpdateTime(DateUtils.getNowDate());
        return tcSjlyMapper.updateTcSjly(tcSjly);
    }

    /**
     * 批量删除硬探针、软探针
     *
     * @param ids 需要删除的硬探针、软探针主键
     * @return 结果
     */
    @Override
    public int deleteTcSjlyByIds(Long[] ids) {
        return tcSjlyMapper.deleteTcSjlyByIds(ids);
    }

    /**
     * 删除硬探针、软探针信息
     *
     * @param id 硬探针、软探针主键
     * @return 结果
     */
    @Override
    public int deleteTcSjlyById(Long id) {
        return tcSjlyMapper.deleteTcSjlyById(id);
    }

    @Override
    public String importUser(List<TcSjly> tcSjlyList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcSjlyList.isEmpty()) {
            for (TcSjly tcSjly : tcSjlyList) {
                tcSjlyMapper.insertTcSjly(tcSjly);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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