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

import androidx.room.*
import com.ys.bdtp.adm.mvvm.model.db.entity.dict.EquipmentDictEntity

/**
 * 表 equipment_dict Dao
 */
@Dao
interface EquipmentDictDao {
    @Query("select * from equipment_dict")
    suspend fun getEquipments(): List<EquipmentDictEntity>

    @Query("select * from equipment_dict where id = :id and valid = 1")
    suspend fun getEquipmentById(id: String): EquipmentDictEntity

    @Query("select * from equipment_dict where code = :code and valid = 1")
    suspend fun getEquipmentByCode(code: String): EquipmentDictEntity?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insEquipment(vararg equipment: EquipmentDictEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insEquipments(equipments: List<EquipmentDictEntity>)

    @Delete
    suspend fun delEquipment(equipment: EquipmentDictEntity)
}