USER_NAME_HOLDER = new ThreadLocal<>();
private UserContextHolder() {
}
- public static void setUserId(Long userId) {
+ public static void setUserId(String userId) {
USER_ID_HOLDER.set(userId);
}
- public static Long getUserId() {
+ public static String getUserId() {
return USER_ID_HOLDER.get();
}
diff --git a/fund-common/src/main/java/com/fundplatform/common/core/BaseEntity.java b/fund-common/src/main/java/com/fundplatform/common/core/BaseEntity.java
index 14ba34e..abce9e3 100644
--- a/fund-common/src/main/java/com/fundplatform/common/core/BaseEntity.java
+++ b/fund-common/src/main/java/com/fundplatform/common/core/BaseEntity.java
@@ -8,25 +8,27 @@ import java.time.LocalDateTime;
*
* 注意:此类不绑定具体 ORM 框架注解(如 JPA、MyBatis-Plus),
* 仅作为字段规范的统一来源,具体映射由各模块自行扩展。
+ *
+ * 主键采用字符串类型(雪花算法生成),解决前端JavaScript大数精度丢失问题。
*/
public abstract class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
- /** 主键ID */
- private Long id;
+ /** 主键ID(雪花算法生成的19位字符串) */
+ private String id;
/** 租户ID(多租户隔离) */
- private Long tenantId;
+ private String tenantId;
/** 创建人 */
- private Long createdBy;
+ private String createdBy;
/** 创建时间 */
private LocalDateTime createdTime;
/** 更新人 */
- private Long updatedBy;
+ private String updatedBy;
/** 更新时间 */
private LocalDateTime updatedTime;
@@ -37,27 +39,27 @@ public abstract class BaseEntity implements Serializable {
/** 备注 */
private String remark;
- public Long getId() {
+ public String getId() {
return id;
}
- public void setId(Long id) {
+ public void setId(String id) {
this.id = id;
}
- public Long getTenantId() {
+ public String getTenantId() {
return tenantId;
}
- public void setTenantId(Long tenantId) {
+ public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
- public Long getCreatedBy() {
+ public String getCreatedBy() {
return createdBy;
}
- public void setCreatedBy(Long createdBy) {
+ public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
@@ -69,11 +71,11 @@ public abstract class BaseEntity implements Serializable {
this.createdTime = createdTime;
}
- public Long getUpdatedBy() {
+ public String getUpdatedBy() {
return updatedBy;
}
- public void setUpdatedBy(Long updatedBy) {
+ public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}