refactor: 后端核心模块功能增强与代码优化
- 完善 User/Product/Order 实体字段和关联关系 - 更新 DTO 适配新增字段 - 增强 Service 层业务逻辑和 Repository 查询方法 - 优化控制器接口,完善管理后台 API - 新增请求监控过滤器和指标服务
This commit is contained in:
@@ -43,9 +43,15 @@ public class User {
|
||||
@Column(length = 20)
|
||||
private String phone;
|
||||
|
||||
@Column(length = 500)
|
||||
private String avatar;
|
||||
|
||||
@Column(name = "status", nullable = false)
|
||||
private Integer status = 1; // 1-正常, 0-禁用
|
||||
|
||||
@Column(name = "role", nullable = false, length = 20)
|
||||
private String role = "USER";
|
||||
|
||||
@Column(name = "last_login")
|
||||
private LocalDateTime lastLogin;
|
||||
|
||||
@@ -57,6 +63,9 @@ public class User {
|
||||
|
||||
@PrePersist
|
||||
protected void onCreate() {
|
||||
if (role == null || role.trim().isEmpty()) {
|
||||
role = "USER";
|
||||
}
|
||||
createdAt = LocalDateTime.now();
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user