package com.persagy.server.dao.mappers

import com.persagy.server.dao.EquipZoneDao
import com.persagy.server.dao.EquipZoneTwoDao
import com.persagy.server.dao.VerticalSpDao
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 EquipmentZoneMapper {

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


    /**
     * 查询所有在业务空间下的设备的id集合
     */
    @Select("select distinct equip_id from r_eq_in_sp_base where project_id = #{projectId}")
    fun selectAllEquipsUnderSpace(@Param("projectId")projectId: String): ArrayList<String>


    /**
     * 相似度匹配
     */
    @SelectProvider(method="similarityDegree", type= EquipZoneDao::class)
    fun similar(@Param("name")name: String,@Param("listStr")listStr:List<String>,@Param("total")total: Int, @Param("similar")similar:Float): String

    /**
     * 相似度匹配
     */
    @SelectProvider(method="similarityDegree", type= EquipZoneTwoDao::class)
    fun similarTwo(@Param("name")name: String,@Param("listStr")listStr:List<String>,@Param("total")total: Int): String

    /**
     * 相似度匹配
     */
    @SelectProvider(method="verticalSp", type= VerticalSpDao::class)
    fun spVerticallySp(@Param("projectId")projectId: String,@Param("buildingId")buildingId: String,@Param("zoneType")zoneType: String,@Param("listStr")listStr:List<String>): Boolean


}