44 lines
807 B
Kotlin
44 lines
807 B
Kotlin
package com.dowstats.data.entities
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
|
import java.io.Serializable
|
|
import jakarta.persistence.*
|
|
|
|
|
|
@Embeddable
|
|
class UnitWeaponKey : Serializable {
|
|
@Column(name = "unit_id")
|
|
var unitId: Long? = null
|
|
|
|
@Column(name = "weapon_id")
|
|
var weaponId: Long? = null
|
|
|
|
}
|
|
|
|
@Entity
|
|
@Table(name = "units_weapons")
|
|
class UnitWeapon {
|
|
|
|
@EmbeddedId
|
|
@JsonIgnore
|
|
var unitWeaponKey: UnitWeaponKey? = null
|
|
|
|
@ManyToOne
|
|
@MapsId("unitId")
|
|
@JoinColumn(name = "unit_id")
|
|
@JsonIgnore
|
|
var unit: DowUnit? = null
|
|
|
|
@ManyToOne
|
|
@MapsId("weaponId")
|
|
@JoinColumn(name = "weapon_id")
|
|
var weapon: Weapon? = null
|
|
|
|
@Column(nullable = false)
|
|
var hardpoint: Int = 0
|
|
|
|
@Column(nullable = false)
|
|
var hardpointOrder: Int = 0
|
|
|
|
}
|