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.CompanyRolePopedomMapper;
import com.springboot.cloud.sysadmin.organization.entity.po.company.CompanyRolePopedom;
import com.springboot.cloud.sysadmin.organization.service.company.CompanyRolePopedomService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class CompanyRolePopedomServiceImpl extends ServiceImpl<CompanyRolePopedomMapper, CompanyRolePopedom> implements CompanyRolePopedomService {

    @Override
    public List<CompanyRolePopedom> getCompanyRolePopedom(String companyId, String roleId) {
        QueryWrapper<CompanyRolePopedom> companyRolePopedomQueryWrapper = new QueryWrapper<>();
        companyRolePopedomQueryWrapper.eq("company_id", companyId).eq("role_id", roleId);
        return this.list(companyRolePopedomQueryWrapper);
    }

    @Override
    public List<CompanyRolePopedom> getCompanyRolePopedom(String companyId, List<String> roleIds) {
        QueryWrapper<CompanyRolePopedom> companyRolePopedomQueryWrapper = new QueryWrapper<>();
        companyRolePopedomQueryWrapper.eq("company_id", companyId).in("role_id", roleIds);
        return this.list(companyRolePopedomQueryWrapper);
    }
}
