CommandDao.java 698 Bytes
Newer Older
pye52 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package com.bgycc.smartcanteen.data.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.bgycc.smartcanteen.entity.Command;

import java.util.List;

@Dao
public interface CommandDao {
    // 搜索所有未完成的指令(0为false)
    @Query("select * from command where finish == 0 order by id asc")
    LiveData<List<Command>> queryUndoneCommand();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long insertCommand(Command command);

    @Update(onConflict = OnConflictStrategy.REPLACE)
    int updateCommand(Command command);
}