package com.persagy.server.dao

import org.apache.ibatis.jdbc.SQL

class TenantZoneDao {

    fun selectTenantUnderSpace(projectId: String, zoneType : String?, zoneId : String?) : String{
        return object : SQL() {
            init {
                SELECT("tn_id")
                FROM("relationship.r_tn2sp")
                // 多个where条件之间是默认and连接
                WHERE("project_id = #{projectId} ")
                if(zoneType != null)
                    WHERE("zone_type = #{zoneType}")
                if(zoneId != null)
                    WHERE("sp_id = #{zoneId}")
            }
        }.toString()
    }
}