commit
f5de8ccf26
@ -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());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.hzu.bookingsystem.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_user")
|
||||||
|
public class UserDTO {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
// 用户ID
|
||||||
|
private Integer uId;
|
||||||
|
|
||||||
|
// 用户姓名
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
// 联系电弧
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
// email
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
//用户名(工号)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
//办公室地点
|
||||||
|
private String office;
|
||||||
|
}
|
Loading…
Reference in new issue