package com.gh.gamecenter.room.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.gh.gamecenter.qa.entity.AnswerEntity;

import java.util.List;

/**
 * Created by khy on 18/04/18.
 */
@Dao
public interface AnswerDao {

    @Query("select * from AnswerEntity where communityId = :communityId order by orderTag DESC")
    LiveData<List<AnswerEntity>> getAnswerEntityById(String communityId);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void addAnswerEntity(List<AnswerEntity> signEntity);

    @Update(onConflict = OnConflictStrategy.REPLACE)
    int updateAnswerEntity(List<AnswerEntity> signEntity);

    @Query("delete from AnswerEntity where communityId = :communityId")
    void deleteData(String communityId);

    @Query("delete from AnswerEntity where id = :answerId")
    void deleteDataByAnswerId(String answerId);
}
