parent
c4e76de15e
commit
e5e0085f59
@ -0,0 +1,22 @@
|
||||
package com.hzu.bookingsystem.converter;
|
||||
|
||||
import com.hzu.bookingsystem.bean.UserBean;
|
||||
import com.hzu.bookingsystem.dto.UserDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserBean2UserDTO {
|
||||
public static UserDTO convert(UserBean user) {
|
||||
|
||||
UserDTO userDTO = new UserDTO();
|
||||
BeanUtils.copyProperties(user, userDTO);
|
||||
return userDTO;
|
||||
}
|
||||
|
||||
public static List<UserDTO> convert(List<UserBean> userList) {
|
||||
return userList.stream().map(UserBean2UserDTO::convert)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
Loading…
Reference in new issue