package com.za.room.db.ele_work

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.za.bean.db.ele.EleCarDamagePhotoBean

@Dao
interface EleCarDamagePhotoDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE, entity = EleCarDamagePhotoBean::class)
    fun insert(eleCarDamagePhotoBean: EleCarDamagePhotoBean)

    @Query("DELETE FROM `ele_car_damage_photo` WHERE orderId =:orderId")
    fun deleteAll(orderId: Int)

    @Query("DELETE FROM `ele_car_damage_photo`")
    fun deleteTable()

    @Delete(entity = EleCarDamagePhotoBean::class)
    fun delete(eleCarDamagePhotoBean: EleCarDamagePhotoBean)

    @Query("SELECT  * FROM ele_car_damage_photo WHERE orderId =:orderId")
    fun getEleCarDamagePhotos(orderId: Int): List<EleCarDamagePhotoBean>?

    @Query("SELECT  * FROM ele_car_damage_photo WHERE id =:id")
    fun getEleCarDamagePhoto(id: Long): EleCarDamagePhotoBean?

    //更新
    @Update(entity = EleCarDamagePhotoBean::class, onConflict = OnConflictStrategy.REPLACE)
    fun update(eleCarDamagePhotoBean: EleCarDamagePhotoBean)
}
