Proyectos de Subversion Android Microlearning

Rev

Autoría | Ultima modificación | Ver Log |

package com.cesams.twogetskills.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.cesams.twogetskills.entity.Topic;
import com.cesams.twogetskills.room.ResultCount;

import java.util.ArrayList;
import java.util.List;

@Dao
public interface TopicDao {

    @Query( "SELECT * FROM tb_topics WHERE uuid = :uuid LIMIT 1")
    Topic selectByUuid(String uuid);


    @Query("SELECT COUNT(*) AS count FROM tb_topics WHERE company_uuid = :companyUuid")
    ResultCount selectTotalByCompanyId(String companyUuid);

    @Query("SELECT * FROM tb_topics WHERE company_uuid = :companyUuid ORDER BY position, name")
    List<Topic> selectAllByCompanyUuid(String companyUuid);

    @Query("SELECT * FROM tb_topics ORDER BY position, name")
    List<Topic> selectAll();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(Topic topic);

    @Update
    void update(Topic topic);

    @Query("DELETE FROM tb_topics WHERE uuid = :uuid ")
    void removeByUuid(String uuid);

    @Query("DELETE FROM tb_topics")
    void removeAll();

}