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.TcYtlcMapper;
import com.ruoyi.tcZz.domain.TcYtlc;
import com.ruoyi.tcZz.service.ITcYtlcService;

/**
 * 约谈流程Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcYtlcServiceImpl implements ITcYtlcService 
{
    @Autowired
    private TcYtlcMapper tcYtlcMapper;

    /**
     * 查询约谈流程
     * 
     * @param id 约谈流程主键
     * @return 约谈流程
     */
    @Override
    public TcYtlc selectTcYtlcById(Long id)
    {
        return tcYtlcMapper.selectTcYtlcById(id);
    }

    /**
     * 查询约谈流程列表
     * 
     * @param tcYtlc 约谈流程
     * @return 约谈流程
     */
    @Override
    public List<TcYtlc> selectTcYtlcList(TcYtlc tcYtlc)
    {
        return tcYtlcMapper.selectTcYtlcList(tcYtlc);
    }

    /**
     * 新增约谈流程
     * 
     * @param tcYtlc 约谈流程
     * @return 结果
     */
    @Override
    public int insertTcYtlc(TcYtlc tcYtlc)
    {
        tcYtlc.setCreateTime(DateUtils.getNowDate());
        return tcYtlcMapper.insertTcYtlc(tcYtlc);
    }

    /**
     * 修改约谈流程
     * 
     * @param tcYtlc 约谈流程
     * @return 结果
     */
    @Override
    public int updateTcYtlc(TcYtlc tcYtlc)
    {
        tcYtlc.setUpdateTime(DateUtils.getNowDate());
        return tcYtlcMapper.updateTcYtlc(tcYtlc);
    }

    /**
     * 批量删除约谈流程
     * 
     * @param ids 需要删除的约谈流程主键
     * @return 结果
     */
    @Override
    public int deleteTcYtlcByIds(Long[] ids)
    {
        return tcYtlcMapper.deleteTcYtlcByIds(ids);
    }

    /**
     * 删除约谈流程信息
     * 
     * @param id 约谈流程主键
     * @return 结果
     */
    @Override
    public int deleteTcYtlcById(Long id)
    {
        return tcYtlcMapper.deleteTcYtlcById(id);
    }

    @Override
    public String importUser(List<TcYtlc> tcYtlcList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcYtlcList.isEmpty()) {
            for (TcYtlc tcYtlc : tcYtlcList) {
                tcYtlcMapper.insertTcYtlc(tcYtlc);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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