package com.yihu.jw.base.dao.org;

import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

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


/**
 * 
 * 机构与Saas关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月20日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseOrgSaasDao extends PagingAndSortingRepository<BaseOrgSaasDO, String>, JpaSpecificationExecutor<BaseOrgSaasDO>  {

    List<BaseOrgSaasDO> findBySaasid(String saasId);

    @Query("select distinct orgCode from BaseOrgSaasDO where saasid = ?1")
    Set<String> findOrgCodeListBySaasid(String saasid);

    @Modifying
    @Query("delete from BaseOrgSaasDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
}