package com.framework.mvvm.model.db.dao

import androidx.room.*
import com.framework.mvvm.model.db.entity.task.QrCodeEntity

/**
 * 表 qr_code Dao
 */
@Dao
interface QrCodeDao {
    @Query("select * from qr_code")
    suspend fun getQrCodes(): List<QrCodeEntity>

    @Query("select * from qr_code where id = :id")
    suspend fun getQrCodeById(id: String): QrCodeEntity

    @Query("select * from qr_code where obj_id = :id")
    suspend fun getQrCodeByObjId(id: String): List<QrCodeEntity>?

    @Query("select * from qr_code where building_id = :id")
    suspend fun getQrCodeByBuildingId(id: String): List<QrCodeEntity>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insQrCode(vararg qrCode: QrCodeEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insQrCodes(qrCodes: List<QrCodeEntity>)

    @Update
    suspend fun updateQrCodes(qrCodes: List<QrCodeEntity>)

    @Delete
    suspend fun delQrCode(qrCode: QrCodeEntity)
}