Commit 8c5e77c4 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix db plan types && explications mapping

parent 6ceae663
...@@ -66,5 +66,5 @@ interface Estate : Persistable { ...@@ -66,5 +66,5 @@ interface Estate : Persistable {
val info_direction: String? val info_direction: String?
@get:OneToMany(mappedBy = "id", cascade = [CascadeAction.SAVE, CascadeAction.DELETE]) @get:OneToMany(mappedBy = "id", cascade = [CascadeAction.SAVE, CascadeAction.DELETE])
val planPreset: Set<PlanPreset> val planPreset: MutableList<PlanPreset>
} }
\ No newline at end of file
...@@ -21,5 +21,5 @@ interface PlanPreset : Persistable { ...@@ -21,5 +21,5 @@ interface PlanPreset : Persistable {
@get:Convert(StringListConverter::class) @get:Convert(StringListConverter::class)
val features:List<String> val features:List<String>
@get:OneToMany(mappedBy = "id", cascade = [CascadeAction.SAVE, CascadeAction.DELETE]) @get:OneToMany(mappedBy = "id", cascade = [CascadeAction.SAVE, CascadeAction.DELETE])
val explication:Set<Explication> val explication:MutableList<Explication>
} }
\ No newline at end of file
...@@ -93,6 +93,62 @@ fun fromRaw(raw:ResolutionRaw) = ...@@ -93,6 +93,62 @@ fun fromRaw(raw:ResolutionRaw) =
fun fromRaw(raw:EstateRaw):EstateEntity{
val entity = EstateEntity()
entity.setId(raw.id)
entity.setType(raw.type)
entity.setNumber(raw.number)
entity.setSectionBegin(raw.common_info.section_begin)
entity.setSectionEnd(raw.common_info.section_end)
entity.setPlanJpgUrl(raw.plan_jpg?.url)
entity.setPlanJpgWidth(raw.plan_jpg?.width)
entity.setPlanJpgHeight(raw.plan_jpg?.height)
entity.setPlanPngUrl(raw.plan_png?.url)
entity.setPlanPngWidth(raw.plan_png?.width)
entity.setPlanPngHeight(raw.plan_png?.height)
entity.setRooms(raw.common_info.rooms)
entity.setAlbumId(raw.album_id)
entity.setMultitourId(raw.multitour_id)
entity.setUrl(raw.url)
entity.setInfo_floor_max(raw.common_info.floor_max)
entity.setInfo_area(raw.common_info.area)
entity.setInfo_area_living(raw.common_info.area_living)
entity.setInfo_kind(raw.common_info.kind)
entity.setInfo_dependent(raw.common_info.dependent)
entity.setInfo_decoration(raw.common_info.decoration)
entity.setInfo_building(raw.common_info.building)
entity.setInfo_section_begin(raw.common_info.section_begin)
entity.setInfo_floor(raw.common_info.floor)
entity.setInfo_window_face(raw.common_info.windows_face)
entity.setInfo_price(raw.common_info.price)
entity.setInfo_price_meter(raw.common_info.price_meter)
entity.setInfo_ceiling(raw.common_info.ceiling)
entity.setInfo_direction(raw.common_info.direction)
return entity
}
fun fromRaw(raw:PlanTypeRaw):PlanPresetEntity{
val entity = PlanPresetEntity()
entity.setFeatures(raw.features)
entity.setPlanId(raw.plan_id)
entity.setTitle(raw.title)
entity.explication.clear()
entity.explication.addAll(fromRawList(raw.explication!!,::fromRaw))
return entity
}
fun fromRaw(raw:EstateRoomRaw):ExplicationEntity{
val entity = ExplicationEntity()
entity.setArea(raw.area)
entity.setLiving(raw.living)
entity.setTitle(raw.title)
return entity
}
//fun fromRaw(raw: List<FeedRaw>):List<FeedEntity> = List(raw.displaySize) { index-> fromRaw(raw[index]) } //fun fromRaw(raw: List<FeedRaw>):List<FeedEntity> = List(raw.displaySize) { index-> fromRaw(raw[index]) }
......
...@@ -45,43 +45,6 @@ data class EstateModel( ...@@ -45,43 +45,6 @@ data class EstateModel(
val url:String? val url:String?
) )
fun fromRaw(raw:EstateRaw):EstateEntity{
val entity = EstateEntity()
entity.setId(raw.id)
entity.setType(raw.type)
entity.setNumber(raw.number)
entity.setSectionBegin(raw.common_info.section_begin)
entity.setSectionEnd(raw.common_info.section_end)
entity.setPlanJpgUrl(raw.plan_jpg?.url)
entity.setPlanJpgWidth(raw.plan_jpg?.width)
entity.setPlanJpgHeight(raw.plan_jpg?.height)
entity.setPlanPngUrl(raw.plan_png?.url)
entity.setPlanPngWidth(raw.plan_png?.width)
entity.setPlanPngHeight(raw.plan_png?.height)
entity.setRooms(raw.common_info.rooms)
entity.setAlbumId(raw.album_id)
entity.setMultitourId(raw.multitour_id)
entity.setUrl(raw.url)
entity.setInfo_floor_max(raw.common_info.floor_max)
entity.setInfo_area(raw.common_info.area)
entity.setInfo_area_living(raw.common_info.area_living)
entity.setInfo_kind(raw.common_info.kind)
entity.setInfo_dependent(raw.common_info.dependent)
entity.setInfo_decoration(raw.common_info.decoration)
entity.setInfo_building(raw.common_info.building)
entity.setInfo_section_begin(raw.common_info.section_begin)
entity.setInfo_floor(raw.common_info.floor)
entity.setInfo_window_face(raw.common_info.windows_face)
entity.setInfo_price(raw.common_info.price)
entity.setInfo_price_meter(raw.common_info.price_meter)
entity.setInfo_ceiling(raw.common_info.ceiling)
entity.setInfo_direction(raw.common_info.direction)
return entity
}
data class PlanModel( data class PlanModel(
val url:String, val url:String,
val width:Int, val width:Int,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment