package com.fs.qw.service.impl;

import com.fs.common.utils.DateUtils;
import com.fs.qw.domain.QwCompany;
import com.fs.qw.mapper.QwCompanyMapper;
import com.fs.qw.service.IQwCompanyService;
import com.fs.qw.vo.QwOptionsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 企微主体Service业务层处理
 *
 * @author fs
 * @date 2024-10-09
 */
@Service
public class QwCompanyServiceImpl implements IQwCompanyService
{
    @Autowired
    private QwCompanyMapper qwCompanyMapper;

    /**
     * 查询企微主体
     *
     * @param id 企微主体主键
     * @return 企微主体
     */
    @Override
    public QwCompany selectQwCompanyById(Long id)
    {
        return qwCompanyMapper.selectQwCompanyById(id);
    }

    @Override
    public QwCompany selectQwCompanyByCorpId(String corpId) {
        return qwCompanyMapper.selectQwCompanyByCorpId(corpId);
    }

    /**
     * 查询企微主体列表
     *
     * @param qwCompany 企微主体
     * @return 企微主体
     */
    @Override
    public List<QwCompany> selectQwCompanyList(QwCompany qwCompany)
    {
        return qwCompanyMapper.selectQwCompanyList(qwCompany);
    }

    /**
     * 新增企微主体
     *
     * @param qwCompany 企微主体
     * @return 结果
     */
    @Override
    public int insertQwCompany(QwCompany qwCompany)
    {
        qwCompany.setCreateTime(DateUtils.getNowDate());
        return qwCompanyMapper.insertQwCompany(qwCompany);
    }

    /**
     * 修改企微主体
     *
     * @param qwCompany 企微主体
     * @return 结果
     */
    @Override
    public int updateQwCompany(QwCompany qwCompany)
    {
        qwCompany.setUpdateTime(DateUtils.getNowDate());
        return qwCompanyMapper.updateQwCompany(qwCompany);
    }

    /**
     * 批量删除企微主体
     *
     * @param ids 需要删除的企微主体主键
     * @return 结果
     */
    @Override
    public int deleteQwCompanyByIds(Long[] ids)
    {
        return qwCompanyMapper.deleteQwCompanyByIds(ids);
    }

    /**
     * 删除企微主体信息
     *
     * @param id 企微主体主键
     * @return 结果
     */
    @Override
    public int deleteQwCompanyById(Long id)
    {
        return qwCompanyMapper.deleteQwCompanyById(id);
    }

    @Override
    public List<QwOptionsVO> selectQwCompanyListOptionsVO() {
        return qwCompanyMapper.selectQwCompanyListOptionsVO();
    }
}
