package Ġru . smart ms . rf id reader writer . db . dao Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . room . Dao Ċ import Ġandroidx . room . Insert Ċ import Ġandroidx . room . On Conflict Strategy Ċ import Ġandroidx . room . Query Ċ import Ġru . smart ms . rf id reader writer . db . entity . Scan Data Ċ Ċ @ Dao Ċ interface ĠScan Data Dao Ġ{ ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ 0 Ġas Ġid , ĠCOUNT ( barcode ) Ġas Ġcount , Ġbarcode , Ġis RF ID , Ġ'' Ġas ĠdateTime ĠFROM Ġsc and ata ĠWHERE Ġis RF ID Ġ= Ġ 1 ĠGROUP ĠBY Ġbarcode ") ĊĠĠĠ Ġfun ĠgetAll (): ĠLive Data < List < Scan Data >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġsc and ata ĠWHERE Ġis RF ID Ġ= Ġ 0 ĠLIMIT Ġ 1 ") ĊĠĠĠ Ġfun Ġget Barcode (): ĠLive Data < Scan Data > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġsc and ata ĠORDER ĠBY ĠID ĠDESC ĠLIMIT Ġ 1 ") ĊĠĠĠ Ġfun ĠgetLast (): ĠLive Data < List < Scan Data >> ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert ( sc and ata : ĠScan Data ) ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert All ( products : ĠList < Scan Data >) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsc and ata ") ĊĠĠĠ Ġfun Ġdelete All () ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsc and ata ĠWHERE Ġbarcode Ġ= Ġ: barcode ") ĊĠĠĠ Ġfun Ġdelete ( barcode : ĠString ?) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsc and ata ĠWHERE Ġis RF ID Ġ= Ġ 0 ") ĊĠĠĠ Ġfun Ġdelete Barcode () Ċ }