Codex Assistant
昨天 afeeed281e60466b576fbe74d339634cc5d07b82
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package com.rongyichuang.employee.dto.response;
 
import com.rongyichuang.employee.entity.Employee;
import com.rongyichuang.user.entity.User;
 
/**
 * 员工响应DTO
 */
public class EmployeeResponse {
    private Long id;
    private String name;
    private String phone;
    private String roleId;
    private String description;
    private Integer state;
    private String createTime;
    private String updateTime;
 
    // 构造函数
    public EmployeeResponse() {}
 
    /**
     * @deprecated 此构造函数已废弃,请使用 EmployeeResponse(Employee, User) 构造函数
     */
    @Deprecated
    public EmployeeResponse(Employee employee) {
        this.id = employee.getId();
        this.name = employee.getName();
        this.phone = employee.getPhone(); // 这里会返回null,因为phone字段已废弃
        this.roleId = employee.getRoleId();
        this.description = employee.getDescription();
        this.state = employee.getState();
        this.createTime = employee.getCreateTime() != null ? employee.getCreateTime().toString() : null;
        this.updateTime = employee.getUpdateTime() != null ? employee.getUpdateTime().toString() : null;
    }
 
    /**
     * 推荐使用的构造函数,从User对象获取phone信息
     */
    public EmployeeResponse(Employee employee, User user) {
        this.id = employee.getId();
        this.name = employee.getName();
        this.phone = user != null ? user.getPhone() : null; // 从User对象获取phone
        this.roleId = employee.getRoleId();
        this.description = employee.getDescription();
        this.state = employee.getState();
        this.createTime = employee.getCreateTime() != null ? employee.getCreateTime().toString() : null;
        this.updateTime = employee.getUpdateTime() != null ? employee.getUpdateTime().toString() : null;
    }
 
    // Getter和Setter方法
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getPhone() {
        return phone;
    }
 
    public void setPhone(String phone) {
        this.phone = phone;
    }
 
    public String getRoleId() {
        return roleId;
    }
 
    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }
 
    public String getDescription() {
        return description;
    }
 
    public void setDescription(String description) {
        this.description = description;
    }
 
    public Integer getState() {
        return state;
    }
 
    public void setState(Integer state) {
        this.state = state;
    }
 
    public String getCreateTime() {
        return createTime;
    }
 
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
 
    public String getUpdateTime() {
        return updateTime;
    }
 
    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
}