refactor/update BankAccountBalance to use KeyedMapper for improved key handling

This commit is contained in:
Hongwei 2025-05-02 11:48:48 +02:00
parent b5df2215ea
commit 239cf64c19

View File

@ -8,10 +8,13 @@ import net.liftweb.mapper._
import net.liftweb.util.Helpers.tryo
class BankAccountBalance extends BankAccountBalanceTrait with LongKeyedMapper[BankAccountBalance] with CreatedUpdated with IdPK {
class BankAccountBalance extends BankAccountBalanceTrait with KeyedMapper[String, BankAccountBalance]{
override def getSingleton = BankAccountBalance
// Define BalanceId_ as the primary key
override def primaryKeyField = BalanceId_.asInstanceOf[KeyedMetaMapper[String, BankAccountBalance]].primaryKeyField
object BankId_ extends MappedUUID(this)
object AccountId_ extends MappedUUID(this)
object BalanceId_ extends MappedUUID(this)
@ -33,4 +36,4 @@ class BankAccountBalance extends BankAccountBalanceTrait with LongKeyedMapper[Ba
override def balanceAmount: BigDecimal = Helper.smallestCurrencyUnitToBigDecimal(BalanceAmount.get, foreignMappedBankAccountCurrency)
}
object BankAccountBalance extends BankAccountBalance with LongKeyedMetaMapper[BankAccountBalance] {}
object BankAccountBalance extends BankAccountBalance with KeyedMetaMapper[String, BankAccountBalance] with CreatedUpdated {}