package cn.lihongjie.coal.organization.repository;

import cn.lihongjie.coal.base.dao.BaseRepository;
import cn.lihongjie.coal.organization.entity.OrganizationEntity;

import org.springframework.data.jpa.repository.Query;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public interface OrganizationRepository extends BaseRepository<OrganizationEntity> {
    @Nullable
    OrganizationEntity findByCode(String code);

    @Query("select u.id || ',' ||  u.name from OrganizationEntity u where u.id in ?1")
    List<String> findNamesByIds(Set<String> ids);
}
