package com.example.chemical.ui.plan.room.dao;

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.example.chemical.ui.plan.room.bean.locker.HxpCabinetDoorVo;
import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetDoorVo;

import java.util.List;

@Dao
public interface HxpDoorDAO {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(HxpCabinetDoorVo doorVo);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertAll(List<HxpCabinetDoorVo> users);

    @Query("SELECT * FROM hxpcabinetdoorvo")
    List<HxpCabinetDoorVo> getAll();

    @Query("SELECT * FROM hxpcabinetdoorvo WHERE doorId = :dooId")
    HxpCabinetDoorVo getById(long dooId);

    @Query("SELECT * FROM hxpcabinetdoorvo WHERE cabinetId = :cabinetId")
    List<HxpCabinetDoorVo> getByCabinetId(long cabinetId);

    @Update
    void update(HxpCabinetDoorVo hxpcabinetdoorvo);

    @Delete
    void delete(HxpCabinetDoorVo hxpcabinetdoorvo);

    @Query("DELETE FROM hxpcabinetdoorvo")
    void deleteAll();

}
