package Ġd sr . amm . home budget . data . repository Ċ Ċ import Ġd sr . amm . home budget . data . entity . Account Ċ import Ġd sr . amm . home budget . data . entity . tx . Transaction Ċ import Ġorg . springframework . data . domain . Page Ċ import Ġorg . springframework . data . domain . Page able Ċ import Ġorg . springframework . data . jpa . repository . Modify ing Ċ import Ġorg . springframework . data . jpa . repository . Query Ċ import Ġorg . springframework . data . repository . Paging And Sorting Repository Ċ import Ġorg . springframework . data . repository . query . Param Ċ import Ġorg . springframework . stereotype . Repository Ċ Ċ import Ġjava . time . Offset DateTime Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġk ne kr as ov Ġon Ġ 1 0 / 1 6 / 2 0 1 8 . Ċ Ġ*/ Ċ @ Repository Ċ interface ĠTransaction Repository < T Ġ: ĠTransaction > Ġ: ĠP aging And Sorting Repository < T , ĠLong > Ġ{ ĊĠĠĠ Ġ@ Query (" from Ġ#{ # entityName } Ġtx Ġwhere Ġsrc Ġ= Ġ? 1 Ġorder Ġby Ġtx . create Date ") ĊĠĠĠ Ġfun ĠfindAll By Account ( page able : ĠPage able , Ġaccount : ĠAccount ): ĠPage < T > ĊĊĠĠĠ Ġ@ Query (" from Ġ#{ # entityName } Ġtx Ġwhere Ġsrc Ġ= Ġ? 1 Ġand Ġid Ġ= Ġ? 2 ") ĊĠĠĠ Ġfun ĠfindBy Account And Id ( account : ĠAccount , Ġid : ĠLong ): ĠAccount ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* Ġfrom ĠTRAN SACTION Ġwhere Ġsrc _ id Ġ= Ġ? 1 Ġorder Ġby Ġcreate _ Date Ġdesc , Ġamount Ġdesc , Ġnew _ value Ġdesc , Ġreason Ġdesc Ġlimit Ġ 1 ", Ġnative Query Ġ= Ġtrue ) ĊĠĠĠ Ġfun Ġfind Last By Account ( account : ĠAccount ): ĠT ? ĊĊĠĠĠ Ġ@ Query (" from Ġ#{ # entityName } Ġtx Ġwhere Ġsrc Ġ= Ġ? 1 Ġand Ġtx . create Date Ġbetween Ġ? 2 Ġand Ġ? 3 Ġorder Ġby Ġtx . create Date ") ĊĠĠĠ Ġfun ĠfindAll By Account With Time Filter ( page able : ĠPage able , Ġaccount : ĠAccount , Ġfrom : ĠOffset DateTime , Ġto : ĠOffset DateTime ): ĠPage < T > ĊĊĠĠĠ Ġ@ Query (" from Ġ#{ # entityName } Ġtx Ġwhere Ġsrc Ġ= Ġ? 1 Ġand Ġtx . create Date Ġ>= Ġ? 2 Ġorder Ġby Ġtx . create Date ") ĊĠĠĠ Ġfun ĠfindAll By Account With Time Filter From ( page able : ĠPage able , Ġaccount : ĠAccount , Ġfrom : ĠOffset DateTime ): ĠPage < T > ĊĊĠĠĠ Ġ@ Query (" from Ġ#{ # entityName } Ġtx Ġwhere Ġsrc Ġ= Ġ? 1 Ġand Ġtx . create Date Ġ<= Ġ? 2 Ġorder Ġby Ġtx . create Date ") ĊĠĠĠ Ġfun ĠfindAll By Account With Time Filter To ( page able : ĠPage able , Ġaccount : ĠAccount , Ġto : ĠOffset DateTime ): ĠPage < T > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* Ġfrom ĠTRAN SACTION Ġwhere Ġsrc _ id Ġ= Ġ? 1 Ġand Ġcreate _ Date Ġ< Ġ? 2 Ġorder Ġby Ġcreate _ Date Ġdesc , Ġamount Ġdesc , Ġnew _ value Ġdesc , Ġreason Ġdesc Ġlimit Ġ 1 ", Ġnative Query Ġ= Ġtrue ) ĊĠĠĠ Ġfun Ġfind Last E ar lier Than ( account : ĠAccount , Ġearlier Than : ĠOffset DateTime ): ĠT ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* Ġfrom ĠTRAN SACTION Ġwhere Ġsrc _ id Ġ= Ġ? 1 Ġand Ġcreate _ Date Ġ>= Ġ? 2 Ġorder Ġby Ġcreate _ Date , Ġamount Ġdesc , Ġnew _ value Ġdesc , Ġreason Ġdesc ", Ġnative Query Ġ= Ġtrue ) ĊĠĠĠ Ġfun ĠfindAll Later Than ( page able : ĠPage able , Ġaccount : ĠAccount , Ġfrom : ĠOffset DateTime ): ĠPage < T > ĊĊĠĠĠ Ġ@ Modify ing ĊĠĠĠ Ġ@ Query (" delete Ġfrom Ġ#{ # entityName } Ġtx Ġwhere Ġsrc Ġ= Ġ: account Ġand Ġtx . id Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġdelete ById (@ Param (" account ") Ġaccount : ĠAccount , Ġ@ Param (" id ") Ġtransaction Id : ĠLong ) Ċ } Ċ