package com.ruoyi.voluntary.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.voluntary.mapper.BusiAgentsMapper;
import com.ruoyi.voluntary.domain.BusiAgents;
import com.ruoyi.voluntary.service.IBusiAgentsService;

/**
 * 代理商Service业务层处理
 *
 * @author voluntary
 * @date 2022-11-20
 */
@Service
public class BusiAgentsServiceImpl implements IBusiAgentsService
{
    @Autowired
    private BusiAgentsMapper busiAgentsMapper;

    /**
     * 查询代理商
     *
     * @param agentId 代理商主键
     * @return 代理商
     */
    @Override
    public BusiAgents selectBusiAgentsByAgentId(Long agentId)
    {
        return busiAgentsMapper.selectBusiAgentsByAgentId(agentId);
    }

    @Override
    public BusiAgents selectBusiAgentsByUserId(Long userId) {
        return busiAgentsMapper.selectBusiAgentsByUserId(userId);
    }

    /**
     * 查询代理商列表
     *
     * @param busiAgents 代理商
     * @return 代理商
     */
    @Override
    public List<BusiAgents> selectBusiAgentsList(BusiAgents busiAgents)
    {
        return busiAgentsMapper.selectBusiAgentsList(busiAgents);
    }

    /**
     * 新增代理商
     *
     * @param busiAgents 代理商
     * @return 结果
     */
    @Override
    public int insertBusiAgents(BusiAgents busiAgents)
    {
        busiAgents.setCreateTime(DateUtils.getNowDate());
        return busiAgentsMapper.insertBusiAgents(busiAgents);
    }

    /**
     * 修改代理商
     *
     * @param busiAgents 代理商
     * @return 结果
     */
    @Override
    public int updateBusiAgents(BusiAgents busiAgents)
    {
        return busiAgentsMapper.updateBusiAgents(busiAgents);
    }

    /**
     * 批量删除代理商
     *
     * @param agentIds 需要删除的代理商主键
     * @return 结果
     */
    @Override
    public int deleteBusiAgentsByAgentIds(Long[] agentIds)
    {
        return busiAgentsMapper.deleteBusiAgentsByAgentIds(agentIds);
    }

    /**
     * 删除代理商信息
     *
     * @param agentId 代理商主键
     * @return 结果
     */
    @Override
    public int deleteBusiAgentsByAgentId(Long agentId)
    {
        return busiAgentsMapper.deleteBusiAgentsByAgentId(agentId);
    }
}
