-
Notifications
You must be signed in to change notification settings - Fork 1
/
InItDataConverter.java
33 lines (29 loc) · 1.09 KB
/
InItDataConverter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.hiit.api.domain.dao.it.in;
import com.hiit.api.domain.dao.AbstractDataConverter;
import com.hiit.api.repository.entity.business.it.DayCodeList;
import com.hiit.api.repository.entity.business.it.InItEntity;
import com.hiit.api.repository.entity.business.it.ItStatus;
import org.springframework.stereotype.Component;
@Component
public class InItDataConverter implements AbstractDataConverter<InItEntity, InItData> {
@Override
public InItData from(InItEntity entity) {
return InItData.builder()
.id(entity.getId())
.title(entity.getTitle())
.resolution(entity.getResolution())
.dayCode(DayCodeInfo.of(entity.getDayCode().getCode()))
.status(ItStatusInfo.valueOf(entity.getStatus().name()))
.memberId(entity.getHiitMember().getId())
.itRelationId(entity.getItRelationEntity().getId())
.build();
}
public InItEntity to(InItData data) {
return InItEntity.builder()
.title(data.getTitle())
.resolution(data.getResolution())
.dayCode(DayCodeList.of(data.getDayCode().getCode()))
.status(ItStatus.valueOf(data.getStatus().name()))
.build();
}
}