package com.yn.bftl.thirdparty.common.repository;

import com.yn.bftl.common.modules.company.entity.Company;
import com.yn.bftl.common.modules.company.enums.RelationType;
import com.yn.bftl.common.modules.relation.entity.CompanyRelation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * @author chendehuihuo
 * @date 2022/7/18 16:17
 */
@Repository
public interface CompanyRelationRepository extends JpaRepository<CompanyRelation, Long> {

    CompanyRelation findFirstByPartyAAndPartyB(Company partyA, Company partyB);

    CompanyRelation findFirstByPartyAAndPartyBAndType(Company partyA, Company partyB, RelationType relationType);

    CompanyRelation findFirstByPartyBAndType(Company partyB, RelationType relationType);
}
