package com.persagy.server.dao.mappers

import com.persagy.server.dao.TenantZoneDao
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.annotations.SelectProvider
import org.springframework.stereotype.Repository


@Mapper
@Repository
interface TenantZoneMapper {


    /** 查询在某种业务空间类型, 某个业务空间实例下的租户的id集合*/
    @SelectProvider(method="selectTenantUnderSpace", type= TenantZoneDao::class)
    fun selectTenantUnderSpace(@Param("projectId")projectId: String, @Param("zoneType")zoneType : String?, @Param("zoneId")zoneId : String?): ArrayList<String>


    /**
     * 查询所有在业务空间下的租户的id集合
     */
    @Select("select distinct tn_id from relationship.r_tn2sp where project_id = #{projectId}")
    fun selectAllTenantUnderSpace(@Param("projectId")projectId: String): ArrayList<String>
}