保誠-保戶業務員媒合平台
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
package com.pollex.pam.service.mapper;
 
import static java.util.stream.Collectors.toList;
 
import java.util.List;
 
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
 
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.service.dto.AppointmentDTO;
 
@Service
public class AppointmentMapper {
 
    public AppointmentDTO toAppointmentDTO(Appointment source) {
        AppointmentDTO target = new AppointmentDTO();
        BeanUtils.copyProperties(source, target);
        return target;
    }
 
    public List<AppointmentDTO> toAppointmentDTO(List<Appointment> source) {
        return source.stream()
                .map(s -> toAppointmentDTO(s)).collect(toList());
    }
 
}