package com.springboot.cloud.sysadmin.organization.service.company.impl;

/*
 **********************************************
 *      DATE           PERSON       REASON
 *    2020-12-29          FXY        Created
 **********************************************
 */


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.springboot.cloud.sysadmin.organization.dao.company.CompanyRoleUserMapper;
import com.springboot.cloud.sysadmin.organization.entity.po.company.CompanyRoleUser;
import com.springboot.cloud.sysadmin.organization.exception.UserNotFoundException;
import com.springboot.cloud.sysadmin.organization.service.company.CompanyRoleUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
@Slf4j
public class CompanyRoleUserServiceImpl extends ServiceImpl<CompanyRoleUserMapper, CompanyRoleUser> implements CompanyRoleUserService {

    @Override
    public List<CompanyRoleUser> getRoleByCompanyIdAndUserId(String companyId, String userId) {
        QueryWrapper<CompanyRoleUser> companyRoleUserQueryWrapper = new QueryWrapper<>();
        companyRoleUserQueryWrapper.eq("company_id", companyId).eq("user_id", userId);
        return this.list(companyRoleUserQueryWrapper);
    }
}
