diff --git a/src/main/kotlin/cn/fadinglight/vo/BillVO.kt b/src/main/kotlin/cn/fadinglight/vo/BillVO.kt new file mode 100644 index 0000000..c8b0347 --- /dev/null +++ b/src/main/kotlin/cn/fadinglight/vo/BillVO.kt @@ -0,0 +1,36 @@ +package cn.fadinglight.vo + +import cn.fadinglight.models.Bill +import cn.fadinglight.models.BillType +import kotlinx.serialization.Serializable + +@Serializable +data class BillVO( + val id: Int? = null, + val type: String, + val date: String, + val money: Float, + val cls: String, + val label: String, + val options: String = "", +) + +fun BillVO.bill() = Bill( + id = id, + type = BillType.valueOf(type), + date = date, + money = money, + cls = cls, + label = label, + options = options, +) + +fun Bill.vo() = BillVO( + id = id, + type = type.name, + date = date, + money = money, + cls = cls, + label = label, + options = options, +) \ No newline at end of file diff --git a/src/main/kotlin/cn/fadinglight/vo/LabelVO.kt b/src/main/kotlin/cn/fadinglight/vo/LabelVO.kt new file mode 100644 index 0000000..c0d93d7 --- /dev/null +++ b/src/main/kotlin/cn/fadinglight/vo/LabelVO.kt @@ -0,0 +1,33 @@ +package cn.fadinglight.vo + +import cn.fadinglight.models.Label +import cn.fadinglight.models.LabelType +import kotlinx.serialization.Serializable + +@Serializable +data class LabelVO( + val name: String, + val count: Int, + var labels: List?, +) + +@Serializable +data class LabelGroup( + val consume: List, + val income: List, +) + + +fun LabelVO.label(type: LabelType) = Label( + id = null, + type = type, + name = name, + count = 0, + relativedId = null +) + +fun Label.vo() = LabelVO( + name = name, + count = count, + labels = emptyList(), +)