package xn.hxp.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 xn.hxp.ui.plan.room.bean.locker.HxpCabinetVo;

import java.util.List;

@Dao
public interface HxpCabinetDAO {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(HxpCabinetVo cabinet);

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

    @Query("SELECT * FROM hxpcabinetvo")
    List<HxpCabinetVo> getAll();

    @Query("SELECT * FROM hxpcabinetvo WHERE cabinetId = :cabinetId")
    HxpCabinetVo getById(long cabinetId);

    @Update
    void update(HxpCabinetVo hxpCabinetVo);

    @Delete
    void delete(HxpCabinetVo hxpCabinetVo);

    @Query("DELETE FROM hxpcabinetvo")
    void deleteAll();
}
