feat(system): 添加日期字段的JSON格式化注解

- 在TenantPackage实体类的createTime和updateTime字段上添加@JsonFormat注解
- 在TenantSubscription实体类的startTime、endTime、createTime和updateTime字段上添加@JsonFormat注解
- 在TenantSubscriptionOrder实体类的startTime、endTime、paymentTime、createTime和updateTime字段上添加@JsonFormat注解
- 所有日期字段均设置pattern为"yyyy-MM-dd HH:mm:ss",timezone为"GMT+8"
- 统一实体类日期序列化格式,提升前后端数据交互一致性
This commit is contained in:
2025-12-14 08:40:00 +08:00
parent b8a70cae5c
commit c32b0eee56
3 changed files with 14 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package com.gxwebsoft.common.system.entity; package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -66,8 +67,10 @@ public class TenantPackage implements Serializable {
private Integer sortNumber; private Integer sortNumber;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
@Schema(description = "修改时间") @Schema(description = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
} }

View File

@@ -1,6 +1,7 @@
package com.gxwebsoft.common.system.entity; package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -35,9 +36,11 @@ public class TenantSubscription implements Serializable {
private Integer version; private Integer version;
@Schema(description = "开始时间") @Schema(description = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
@Schema(description = "到期时间") @Schema(description = "到期时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime; private Date endTime;
@Schema(description = "是否试用期") @Schema(description = "是否试用期")
@@ -59,9 +62,11 @@ public class TenantSubscription implements Serializable {
private Integer status; private Integer status;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
@Schema(description = "修改时间") @Schema(description = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
// 关联查询字段 // 关联查询字段

View File

@@ -1,6 +1,7 @@
package com.gxwebsoft.common.system.entity; package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -54,9 +55,11 @@ public class TenantSubscriptionOrder implements Serializable {
private BigDecimal actualPrice; private BigDecimal actualPrice;
@Schema(description = "开始时间") @Schema(description = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
@Schema(description = "到期时间") @Schema(description = "到期时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime; private Date endTime;
@Schema(description = "是否试用 0否 1是") @Schema(description = "是否试用 0否 1是")
@@ -78,6 +81,7 @@ public class TenantSubscriptionOrder implements Serializable {
private String paymentId; private String paymentId;
@Schema(description = "支付时间") @Schema(description = "支付时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date paymentTime; private Date paymentTime;
@Schema(description = "订单状态 0待支付 1已支付 2已激活 3已取消 4已退款") @Schema(description = "订单状态 0待支付 1已支付 2已激活 3已取消 4已退款")
@@ -90,8 +94,10 @@ public class TenantSubscriptionOrder implements Serializable {
private Integer userId; private Integer userId;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
@Schema(description = "修改时间") @Schema(description = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
} }