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.HxpCabinetDoorVo;
import xn.hxp.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 = :doorId")
    HxpCabinetDoorVo getById(long doorId);

    @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();

}
