package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.SCompanyMapper;
import com.ruoyi.business.domain.SCompany;
import com.ruoyi.business.service.ISCompanyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 公司Service业务层处理
 * 
 * @author xiatao
 * @date 2022-01-18
 */
@Service
public class SCompanyServiceImpl implements ISCompanyService 
{
    @Autowired
    private SCompanyMapper sCompanyMapper;

    /**
     * 查询公司
     * 
     * @param companyId 公司主键
     * @return 公司
     */
    @Override
    public SCompany selectSCompanyByCompanyId(Long companyId)
    {
        return sCompanyMapper.selectSCompanyByCompanyId(companyId);
    }

    /**
     * 查询公司列表
     * 
     * @param sCompany 公司
     * @return 公司
     */
    @Override
    public List<SCompany> selectSCompanyList(SCompany sCompany)
    {
        return sCompanyMapper.selectSCompanyList(sCompany);
    }

    /**
     * 新增公司
     * 
     * @param sCompany 公司
     * @return 结果
     */
    @Override
    public int insertSCompany(SCompany sCompany)
    {
        sCompany.setCreateTime(DateUtils.getNowDate());
        return sCompanyMapper.insertSCompany(sCompany);
    }

    /**
     * 修改公司
     * 
     * @param sCompany 公司
     * @return 结果
     */
    @Override
    public int updateSCompany(SCompany sCompany)
    {
        sCompany.setUpdateTime(DateUtils.getNowDate());
        return sCompanyMapper.updateSCompany(sCompany);
    }

    /**
     * 批量删除公司
     * 
     * @param companyIds 需要删除的公司主键
     * @return 结果
     */
    @Override
    public int deleteSCompanyByCompanyIds(String companyIds)
    {
        return sCompanyMapper.deleteSCompanyByCompanyIds(Convert.toStrArray(companyIds));
    }

    /**
     * 删除公司信息
     * 
     * @param companyId 公司主键
     * @return 结果
     */
    @Override
    public int deleteSCompanyByCompanyId(Long companyId)
    {
        return sCompanyMapper.deleteSCompanyByCompanyId(companyId);
    }
}
