package com.ys.bdtp.adm.mvvm.model.db.dao

import androidx.room.*
import com.ys.bdtp.adm.mvvm.model.vo.Object

/**
 * 表 object Dao
 */
/*
@Dao
interface ObjectDao {
    @Query("select * from object")
    suspend fun getObjects(): List<Object>

    @Query("select * from object where id = :id and valid = 1")
    suspend fun getObjectById(id: String): Object?

    @Query("select * from object where bim_id = :bimId")
    suspend fun getObjectByBimId(bimId: String): Object?

    @Query("select * from object where obj_type = :objType and valid = 1")
    suspend fun getObjectByObjType(objType: String): List<Object>

    @Query("select * from object where building_id = :buildingId and obj_type=:type and valid = 1")
    suspend fun getObjectByBuildingId(buildingId: String, type: String): List<Object>

    @Query("select * from object where building_id = :buildingId and valid = 1")
    suspend fun getObjectByBuildingId(buildingId: String): List<Object>

    @Query("select * from object where floor_id = :floorId and obj_type=:type and valid = 1")
    suspend fun getEquipByFloorId(
        floorId: String,
        type: String,
    ): List<Object>

    @Query("select * from object where class_code = :code and building_id =:buildingId and valid = 1")
    suspend fun getObjectByCode(code: String, buildingId: String): List<Object>

    @Query("select * from object where container_id = :objId and valid = 1")
    suspend fun getContainerObjs(objId: String): List<Object>

    @Query("select * from object where local_id = UPPEr(:localId) and valid = 1")
    suspend fun getObjectByLocalId(localId: String): Object?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insObject(vararg obj: Object)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insObjects(objects: List<Object>)

    @Update
    suspend fun updateObjects(objects: List<Object>)

    @Delete
    suspend fun delObject(obj: Object)

    */
/**
     * 返回楼层类型的 ObjectEntity
     *//*

    @Query("select * from object where obj_type = 'floor'")
    suspend fun getFloors(): List<Object>

    */
/**
     * 返回楼层类型的 ObjectEntity
     *//*

    @Query("select * from object where obj_type = 'floor' and building_id =:buildingId")
    suspend fun getFloorsByBuildingId(buildingId: String): List<Object>

    */
/**
     * 返回楼层类型的 ObjectEntity
     *//*

    @Query("select * from object where obj_type = 'floor' and id =:floorId")
    suspend fun getFloorById(floorId: String): Object

    */
/**
     * 返回所有建筑 ObjectEntity
     *//*

    @Query("select * from object where obj_type = 'building'")
    suspend fun getBuildings(): List<Object>

    */
/**
     * 返回项目下的建筑
     * *//*

    @Query("select * from object where obj_type = 'building' and project_id = :projectId")
    suspend fun getBuildingsByProjectId(projectId: String): List<Object>

    */
/**
     * 返回所有建筑 ObjectEntity
     *//*

    @Query("select * from object where obj_type = 'space' and class_code ='GeneralZone' and floor_id =:floorId")
    suspend fun getSpaceByFloorId(floorId: String): List<Object>

    */
/**
     * 更新 ObjectEntity
     *//*

    @Update
    suspend fun updateObject(obj: Object)

    // @Transaction
    // @Query("select * from object")
    // fun getObjectAndInfosWithOutlines() : List<ObjectAndInfosWithOutlines>

    @Query("select count(*) from object where project_id = :projectId and (state = 0 or state = 1)")
    suspend fun countUnDone(projectId: String): Int
}*/
