package com.stm.asset.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.stm.asset.model.InventoryInfo;

import java.util.List;

/**
 * 类名称：InventoryInfoDao
 * 类描述：InventoryInfoDao
 * 创建人：story
 * 创建时间：2021-12-09 16:36
 */
@Dao
public interface InventoryInfoDao {

    /**
     * 查询所有数据
     */
    @Query("select * from inventoryInfo")
    List<InventoryInfo> getAllInventoryInfoList();

    @Query("select * from inventoryInfo where (status = '0' or status = '1')")
    List<InventoryInfo> getUndoInventoryList();

    @Query("select * from inventoryInfo where status = '2'")
    List<InventoryInfo> getDoneInventoryList();

    /**
     * 插入数据
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long[] insertInventoryList(List<InventoryInfo> inventoryInfoList);

    /**
     * 修改数据
     */
    @Update
    int updateInventory(InventoryInfo inventoryInfo);

    /**
     * 删除数据
     */
    @Delete
    int deleteInventoryList(List<InventoryInfo> inventoryInfoList);

}
