@@ -5,16 +5,24 @@ import com.example.jhouse_server.domain.scrap.entity.Scrap
5
5
import com.example.jhouse_server.domain.user.entity.User
6
6
import com.example.jhouse_server.global.entity.BaseEntity
7
7
import javax.persistence.*
8
- @Table(name = " house" ,
9
- indexes = [Index (name = " idx__rental_type" , columnList = " rentalType, useYn, tmpYn, reported, applied" ),
8
+
9
+ @Table(
10
+ name = " house" ,
11
+ indexes = [Index (
12
+ name = " idx__rental_type" ,
13
+ columnList = " rentalType, useYn, tmpYn, reported, applied"
14
+ ),
10
15
Index (name = " idx__title" , columnList = " title, useYn, tmpYn, reported, applied" )
11
- ])
16
+ ]
17
+ )
12
18
@Entity
13
19
class House (
14
20
21
+ var agentDetail : String? ,
22
+
15
23
@Enumerated(EnumType .STRING )
16
24
@Column(name = " house_type" )
17
- var houseType : HouseType , // 매물타입
25
+ var houseType : HouseType , // 매물타입
18
26
19
27
@Convert(converter = RentalTypeConverter ::class )
20
28
@Column(length = 40 )
@@ -30,18 +38,18 @@ class House(
30
38
var purpose : String? , // 용도 ( 예: 주택 )
31
39
32
40
@Column(nullable = true )
33
- var floorNum : Int , // 층수 ( 다가구인 경우에만 )
41
+ var floorNum : Int , // 층수 ( 다가구인 경우에만 )
34
42
35
43
@Column(length = 13 )
36
- var contact : String , // 바로 연락 가능한 연락처
44
+ var contact : String , // 바로 연락 가능한 연락처
37
45
38
46
@Column(length = 5 )
39
- var createdDate : String? , // 준공연도,
47
+ var createdDate : String? , // 준공연도,
40
48
41
49
var price : Int , // 매물가격
42
50
43
51
@Column(nullable = true )
44
- var monthlyPrice : Double , // 월세의 경우,
52
+ var monthlyPrice : Double , // 월세의 경우,
45
53
46
54
@Column(length = 20 )
47
55
var agentName : String , // 공인중개사명
@@ -50,28 +58,28 @@ class House(
50
58
var title : String , // 게시글 제목
51
59
52
60
@Column(length = Int .MAX_VALUE )
53
- var content : String , // 게시글 내용
61
+ var content : String , // 게시글 내용
54
62
55
63
@Column(length = Int .MAX_VALUE )
56
- var code : String , // 게시글 코드
64
+ var code : String , // 게시글 코드
57
65
58
66
@Column(length = Int .MAX_VALUE )
59
67
@Convert(converter = BoardImageUrlConverter ::class ) // 이미지 url ","로 슬라이싱
60
- var imageUrls : List <String >,
68
+ var imageUrls : List <String >,
61
69
62
70
@ManyToOne(fetch = FetchType .LAZY )
63
71
@JoinColumn(name = " user_id" , nullable = false )
64
- var user : User ,
72
+ var user : User ,
65
73
66
- var useYn : Boolean = true , // 삭제여부 ( 미삭제 : true, 삭제 : false )
74
+ var useYn : Boolean = true , // 삭제여부 ( 미삭제 : true, 삭제 : false )
67
75
68
- var tmpYn : Boolean = false , // 임시저장여부 ( 임시저장: true, 저장 : false )
76
+ var tmpYn : Boolean = false , // 임시저장여부 ( 임시저장: true, 저장 : false )
69
77
70
- var reported : Boolean = false , // 신고여부 ( 신고: true, 미신고 : false )
78
+ var reported : Boolean = false , // 신고여부 ( 신고: true, 미신고 : false )
71
79
72
80
@Convert(converter = HouseReviewStatusConverter ::class )
73
81
@Column(length = 10 )
74
- var applied : HouseReviewStatus ? = null , // 신청여부
82
+ var applied : HouseReviewStatus ? = null , // 신청여부
75
83
76
84
@Column(nullable = true , length = 200 )
77
85
var rejectReason : String? = null , // 관리자가 게시글을 반려한 이유
@@ -93,24 +101,26 @@ class House(
93
101
) : BaseEntity() {
94
102
95
103
@OneToOne
96
- lateinit var deal: Deal
104
+ lateinit var deal: Deal
97
105
98
106
fun updateEntity (
107
+ agentDetail : String? ,
99
108
houseType : HouseType ,
100
- rentalType : RentalType ,
101
- size : String ,
102
- purpose : String? ,
103
- floorNum : Int ,
104
- contact : String ,
105
- createdDate : String? ,
106
- price : Int ,
107
- monthlyPrice : Double ,
108
- agentName : String ,
109
- title : String ,
110
- content : String ,
111
- code : String ,
112
- imageUrls : List <String >
113
- ) : House {
109
+ rentalType : RentalType ,
110
+ size : String ,
111
+ purpose : String? ,
112
+ floorNum : Int ,
113
+ contact : String ,
114
+ createdDate : String? ,
115
+ price : Int ,
116
+ monthlyPrice : Double ,
117
+ agentName : String ,
118
+ title : String ,
119
+ content : String ,
120
+ code : String ,
121
+ imageUrls : List <String >
122
+ ): House {
123
+ this .agentDetail = agentDetail
114
124
this .houseType = houseType
115
125
this .rentalType = rentalType
116
126
this .size = size
@@ -127,6 +137,7 @@ class House(
127
137
this .imageUrls = imageUrls
128
138
return this
129
139
}
140
+
130
141
fun deleteEntity () {
131
142
this .useYn = false
132
143
}
@@ -150,7 +161,7 @@ class House(
150
161
this .rejectReason = rejectReason
151
162
}
152
163
153
- fun addScrap (scrap : Scrap ) : House {
164
+ fun addScrap (scrap : Scrap ): House {
154
165
this .scrap.add(scrap)
155
166
return this
156
167
}
@@ -172,7 +183,7 @@ class House(
172
183
this .dealState = DealState .COMPLETED
173
184
}
174
185
175
- fun addHouseTag (houseTag : HouseTag ) : House {
186
+ fun addHouseTag (houseTag : HouseTag ): House {
176
187
this .houseTag.add(houseTag)
177
188
return this
178
189
}
0 commit comments