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.TcZdqymlMapper;
import com.ruoyi.tcZz.domain.TcZdqyml;
import com.ruoyi.tcZz.service.ITcZdqymlService;

/**
 * 重点企业名录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@Service
public class TcZdqymlServiceImpl implements ITcZdqymlService 
{
    @Autowired
    private TcZdqymlMapper tcZdqymlMapper;

    /**
     * 查询重点企业名录
     * 
     * @param id 重点企业名录主键
     * @return 重点企业名录
     */
    @Override
    public TcZdqyml selectTcZdqymlById(Long id)
    {
        return tcZdqymlMapper.selectTcZdqymlById(id);
    }

    /**
     * 查询重点企业名录列表
     * 
     * @param tcZdqyml 重点企业名录
     * @return 重点企业名录
     */
    @Override
    public List<TcZdqyml> selectTcZdqymlList(TcZdqyml tcZdqyml)
    {
        return tcZdqymlMapper.selectTcZdqymlList(tcZdqyml);
    }

    /**
     * 新增重点企业名录
     * 
     * @param tcZdqyml 重点企业名录
     * @return 结果
     */
    @Override
    public int insertTcZdqyml(TcZdqyml tcZdqyml)
    {
        tcZdqyml.setCreateTime(DateUtils.getNowDate());
        return tcZdqymlMapper.insertTcZdqyml(tcZdqyml);
    }

    /**
     * 修改重点企业名录
     * 
     * @param tcZdqyml 重点企业名录
     * @return 结果
     */
    @Override
    public int updateTcZdqyml(TcZdqyml tcZdqyml)
    {
        tcZdqyml.setUpdateTime(DateUtils.getNowDate());
        return tcZdqymlMapper.updateTcZdqyml(tcZdqyml);
    }

    /**
     * 批量删除重点企业名录
     * 
     * @param ids 需要删除的重点企业名录主键
     * @return 结果
     */
    @Override
    public int deleteTcZdqymlByIds(Long[] ids)
    {
        return tcZdqymlMapper.deleteTcZdqymlByIds(ids);
    }

    /**
     * 删除重点企业名录信息
     * 
     * @param id 重点企业名录主键
     * @return 结果
     */
    @Override
    public int deleteTcZdqymlById(Long id)
    {
        return tcZdqymlMapper.deleteTcZdqymlById(id);
    }

    @Override
    public String importUser(List<TcZdqyml> tcZdqymlList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcZdqymlList.isEmpty()) {
            for (TcZdqyml tcZdqyml : tcZdqymlList) {
                tcZdqymlMapper.insertTcZdqyml(tcZdqyml);
            }
            successMsg.append("导入成功");
        }
        return successMsg.toString();
    }

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