package com.ecep.contract.ds.company.repository;

import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

import com.ecep.contract.ds.MyRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.ecep.contract.ds.company.model.Company;

@Repository
public interface CompanyRepository extends MyRepository<Company, Integer> {

    List<Company> findAllByName(String name);

    Optional<Company> findFirstByName(String name);

    List<Company> findAllByShortName(String shortName);

    /**
     * @param uniscid 统一社会信用代码
     */
    List<Company> findAllByUniscid(String uniscid);

    @Query("select u from Company u")
    Stream<Company> findAllAsStream();
}
