0

这是我的数据类。

@Entity
@Table(name = "loan_category")
data class Loan_category (

    @Id
    @Column(name = "loan_id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    val id: Long? = null,

    @Column(name = "category_name",unique = true,nullable = false)
    val categoryName : String = "",

    @Column(name = "interest_rate")
    val interest_rate : Float = 0.0F,

    @Column(name = "overdue_interest")
    val overdue_interest : Float = 0.0F,

    @Column(name = "overdue_period")
    val overdue_period : String = "",

    @Column(name = "minSurety")
    val minSurety:Int = 0,

    @Column(name = "totaline")
    val totalFine: Float = 0.0F
)

我想像ArrayList在另一个实体中一样声明这个数据类。怎么做到呢?

4

1 回答 1

0

如果我理解正确,你想在另一个数据类中列出这个数据类吗?

data class Loan(
    @SerializedName("loan_categories")
    val categories: List<LoanCategory>
)

你会把它实例化为

Loan(emptyList())
于 2018-09-20T07:40:08.963 回答