package com.fs.company.service.impl;

import com.fs.company.domain.CompanyUserRole;
import com.fs.company.mapper.CompanyUserRoleMapper;
import com.fs.company.service.ICompanyUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户和角色关联Service业务层处理
 *
 * @author fs
 * @date 2021-05-25
 */
@Service
public class CompanyUserRoleServiceImpl implements ICompanyUserRoleService
{
    @Autowired
    private CompanyUserRoleMapper companyUserRoleMapper;

    /**
     * 查询用户和角色关联
     *
     * @param userId 用户和角色关联ID
     * @return 用户和角色关联
     */
    @Override
    public CompanyUserRole selectCompanyUserRoleById(Long userId)
    {
        return companyUserRoleMapper.selectCompanyUserRoleById(userId);
    }

    /**
     * 查询用户和角色关联列表
     *
     * @param companyUserRole 用户和角色关联
     * @return 用户和角色关联
     */
    @Override
    public List<CompanyUserRole> selectCompanyUserRoleList(CompanyUserRole companyUserRole)
    {
        return companyUserRoleMapper.selectCompanyUserRoleList(companyUserRole);
    }

    /**
     * 新增用户和角色关联
     *
     * @param companyUserRole 用户和角色关联
     * @return 结果
     */
    @Override
    public int insertCompanyUserRole(CompanyUserRole companyUserRole)
    {
        return companyUserRoleMapper.insertCompanyUserRole(companyUserRole);
    }

    /**
     * 修改用户和角色关联
     *
     * @param companyUserRole 用户和角色关联
     * @return 结果
     */
    @Override
    public int updateCompanyUserRole(CompanyUserRole companyUserRole)
    {
        return companyUserRoleMapper.updateCompanyUserRole(companyUserRole);
    }

    /**
     * 批量删除用户和角色关联
     *
     * @param userIds 需要删除的用户和角色关联ID
     * @return 结果
     */
    @Override
    public int deleteCompanyUserRoleByIds(Long[] userIds)
    {
        return companyUserRoleMapper.deleteCompanyUserRoleByIds(userIds);
    }

    /**
     * 删除用户和角色关联信息
     *
     * @param userId 用户和角色关联ID
     * @return 结果
     */
    @Override
    public int deleteCompanyUserRoleById(Long userId)
    {
        return companyUserRoleMapper.deleteCompanyUserRoleById(userId);
    }


    @Override
    public void batchInsertCompanyUserRole(List<CompanyUserRole> collect) {
        companyUserRoleMapper.batchUserRole(collect);
    }
}
