Commit c6c27f3b authored by Muhammad Suryono's avatar Muhammad Suryono

maintenance daos

parent 6a44ae1a
package com.yono.messeripos.daos; package com.yono.messeripos.daos;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert; import androidx.room.Insert;
import androidx.room.OnConflictStrategy; import androidx.room.OnConflictStrategy;
import androidx.room.Query; import androidx.room.Query;
...@@ -11,16 +12,17 @@ import com.yono.messeripos.models.ProductCartModels; ...@@ -11,16 +12,17 @@ import com.yono.messeripos.models.ProductCartModels;
import java.util.List; import java.util.List;
@Dao
public interface PaymentPendingDaos { public interface PaymentPendingDaos {
@Query("SELECT * FROM payment_pending ORDER BY id DESC") @Query("SELECT * FROM paymentPending ORDER BY id DESC")
public LiveData<List<PaymentPending>> getAll(); public LiveData<List<PaymentPending>> getAll();
@Query("SELECT * FROM payment_pending WHERE id_orders = :idOrders") @Query("SELECT * FROM paymentPending WHERE id_orders = :idOrders")
public LiveData<List<PaymentPending>> getPaymentByIdOrder(String idOrders); public LiveData<List<PaymentPending>> getPaymentByIdOrder(String idOrders);
@Insert(onConflict = OnConflictStrategy.IGNORE) @Insert(onConflict = OnConflictStrategy.IGNORE)
public void insertPaymentPending(PaymentPending paymentPending); public void insertPaymentPending(PaymentPending paymentPending);
@Query("UPDATE payment_pending SET id_nfc = :idNfc WHERE id = :id") @Query("UPDATE paymentPending SET id_nfc = :idNfc WHERE id = :id")
public void updateNfc (String idNfc, long id); public void updateNfc (String idNfc, long id);
} }
...@@ -34,7 +34,7 @@ public abstract class LocalDatabase extends RoomDatabase { ...@@ -34,7 +34,7 @@ public abstract class LocalDatabase extends RoomDatabase {
synchronized (LocalDatabase.class){ synchronized (LocalDatabase.class){
if (INSTANCE == null){ if (INSTANCE == null){
INSTANCE = Room.databaseBuilder(context.getApplicationContext(), INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
LocalDatabase.class, "db_new").build(); LocalDatabase.class, "db_messer").build();
} }
} }
} }
......
...@@ -8,7 +8,7 @@ import androidx.room.PrimaryKey; ...@@ -8,7 +8,7 @@ import androidx.room.PrimaryKey;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@Entity(tableName = "payment_pending") @Entity(tableName = "paymentPending")
public class PaymentPending implements Parcelable { public class PaymentPending implements Parcelable {
@PrimaryKey(autoGenerate = true) @PrimaryKey(autoGenerate = true)
@SerializedName("id") @SerializedName("id")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment