package Ġcom . f ars heel . my pos . data . local . dao Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . paging . DataSource Ċ import Ġandroidx . room . Dao Ċ import Ġandroidx . room . Insert Ċ import Ġandroidx . room . On Conflict Strategy Ċ import Ġandroidx . room . Query Ċ import Ġcom . f ars heel . my pos . data . model . Order Detail Entity Ċ import Ġcom . f ars heel . my pos . data . model . Order Item Entity Ċ import Ġio . reactivex . Single Ċ Ċ @ Dao Ċ interface ĠOrder Dao Ġ{ ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠOrder Detail ĠWHERE ĠOrder Id Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġfind ById ( id : ĠLong ): ĠLive Data < Order Detail Entity > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠOrder Detail ĠORDER ĠBY ĠOrder Id ") ĊĠĠĠ Ġfun ĠgetAll (): ĠLive Data < List < Order Detail Entity >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠOrder Detail ĠORDER ĠBY ĠOrder Id ") ĊĠĠĠ Ġfun ĠgetAll Paged (): ĠDataSource . Factory < Int , ĠOrder Detail Entity > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠOrder Detail ĠWHERE ĠOrder Id ĠLIKE Ġ: search ĠORDER ĠBY ĠOrder Id ĠDESC ") ĊĠĠĠ Ġfun ĠgetAll Paged ( search : ĠString ): ĠDataSource . Factory < Int , ĠOrder Detail Entity > ĊĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert ( order Detail Entity : ĠOrder Detail Entity ): ĠSingle < Long > ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert All ( order Detail Entities : ĠList < Order Detail Entity >) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM ĠOrder Detail ĠWHERE ĠOrder Id Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġdelete ById ( id : ĠLong ): ĠSingle < Int > ĊĊĠĠĠ Ġ@ Query (" UPDATE Ġ ĠOrder Detail ĠSET ĠPayment Status Ġ= Ġ: payment Status ĠWHERE ĠOrder Id Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġupdate Payment Status ( payment Status : ĠString , id : Long ) ĊĊĊĠĠĠ Ġ// ĠOrder Items ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠOrder Item ĠWHERE ĠOrder Id Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġfind Order Items By OrderId ( id : ĠLong ): ĠLive Data < List < Order Item Entity >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠOrder Item ĠWHERE ĠOrder Id Ġ= Ġ: orderId ĠORDER ĠBY ĠOrder Id ") ĊĠĠĠ Ġfun ĠgetAll Order Items Paged ( orderId : ĠLong ): ĠDataSource . Factory < Int , ĠOrder Item Entity > ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert Order Item ( order Item Entity : ĠOrder Item Entity ): ĠSingle < Long > ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert Order ItemList ( order Items : ĠList < Order Item Entity >): ĠSingle < List < Long >> Ċ Ċ }