Advertisement
BITWIS3

Untitled

Apr 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.03 KB | None | 0 0
  1. package com.gainwise.transactional.RoomFiles;
  2.  
  3.  
  4. import android.arch.persistence.room.Dao;
  5. import android.arch.persistence.room.Delete;
  6. import android.arch.persistence.room.Insert;
  7. import android.arch.persistence.room.Query;
  8.  
  9. import com.gainwise.transactional.POJO.Transaction;
  10.  
  11. import java.util.List;
  12.  
  13. @Dao
  14. public interface TransactionDAO {
  15.  
  16.     @Query("SELECT * FROM _table_transactions WHERE _type_entry LIKE 'reg'")
  17.     public List<Transaction> getAllTransactions();
  18.  
  19.     @Query("SELECT * FROM _table_transactions WHERE _type_entry LIKE 'reg' ORDER BY _id DESC LIMIT 50")
  20.     public List<Transaction> getRecentHistoryTransactions();
  21.  
  22.     @Query("SELECT * FROM _table_transactions WHERE _type_entry LIKE 'info'")
  23.     public List<Transaction> getAllTransactionsInfo();
  24.  
  25.     @Query("UPDATE _table_transactions SET _amount = :newAmount WHERE _id = :id")
  26.     public void updateTransactionAmountWithID(int id, String newAmount);
  27.  
  28.     @Query("UPDATE _table_transactions SET _main_label = :newLabel WHERE _id = :id")
  29.     public void updateTransactionMainLabelWithID(int id, String newLabel);
  30.  
  31.     @Query("UPDATE _table_transactions SET _cross_reference_id = :crossRef WHERE _id = :id")
  32.     public void updateTransactionCrossRefIDWithID(int id, String crossRef);
  33.  
  34.     @Query("UPDATE _table_transactions SET _cross_reference_adjust_for_stats = :crossRefAdjust WHERE _id = :id")
  35.     public void updateTransactionCrossRefAdjustForStatsWithID(int id, String crossRefAdjust);
  36.  
  37.     @Query("UPDATE _table_transactions SET _cross_reference_amount = :crossRefAmount WHERE _id = :id")
  38.     public void updateTransactionCrossRefAmountWithID(int id, String crossRefAmount);
  39.  
  40.     @Query("UPDATE _table_transactions SET _account = :newAccount WHERE _id = :id")
  41.     public void updateTransactionAccountWithID(int id, String newAccount);
  42.  
  43.     @Query("UPDATE _table_transactions SET _sub_label = :newLabel WHERE _id = :id")
  44.     public void updateTransactionSubLabelWithID(int id, String newLabel);
  45.  
  46.     @Query("SELECT _current_balance FROM _table_transactions WHERE _type_entry NOT LIKE 'info' ORDER BY _id DESC LIMIT 1")
  47.     public String getLastBalance();
  48.  
  49.     @Query("SELECT _color_1 FROM _table_transactions WHERE _main_label = :main AND _type_entry LIKE 'info' ORDER BY _id ASC LIMIT 1")
  50.     public String getColorOfMain(String main);
  51.  
  52.     @Query("UPDATE _table_transactions SET _additional_info = :newAdditionalInfo WHERE _id = :id")
  53.     public void updateTransactionAdditionalInfoWithID(int id, String newAdditionalInfo);
  54.  
  55.     @Query("SELECT _amount FROM _table_transactions")
  56.     public List<String> fetchAllTransactionAmountsOnly();
  57.  
  58.     @Query("SELECT _current_balance FROM _table_transactions")
  59.     public List<String> fetchAllTransactionCurrentBalancesOnly();
  60.  
  61.     @Query("SELECT DISTINCT _main_label FROM _table_transactions WHERE _type_entry LIKE 'info' ORDER BY _main_label ASC")
  62.     public List<String> fetchAllTransactionMainLabelsOnly();
  63.  
  64.     @Query("SELECT * FROM _table_transactions WHERE _type_entry LIKE 'info' ORDER BY _main_label ASC")
  65.     public List<Transaction> fetchAllTransactionsLabels();
  66.  
  67.     @Query("SELECT DISTINCT _sub_label FROM _table_transactions WHERE _main_label LIKE :mainLabel AND _type_entry LIKE 'info' ORDER BY _sub_label ASC")
  68.     public List<String> fetchAllTransactionStringOnlySubLabelsOnlyWithMainLabel(String mainLabel);
  69.  
  70.     @Query("SELECT DISTINCT _sub_label FROM _table_transactions WHERE _main_label LIKE :mainLabel AND _type_entry LIKE 'info' ORDER BY _sub_label DESC LIMIT 1")
  71.     public String fetchLatestSubWithMain(String mainLabel);
  72.  
  73.     @Query("SELECT * FROM _table_transactions WHERE _main_label LIKE :mainLabel AND _type_entry LIKE 'info' ORDER BY _sub_label ASC")
  74.     public List<Transaction> fetchAllTransactionSubLabelsOnlyWithMainLabel(String mainLabel);
  75.  
  76.     @Insert
  77.     public void insertAll(Transaction... transactions);
  78.  
  79.     @Delete
  80.     public void delete(Transaction transaction);
  81.  
  82.     @Query("DELETE FROM _table_transactions WHERE _id = :id")
  83.     public void deleteTransactionWithID(int id);
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement