Selaa lähdekoodia

style(model): 优化时间字段格式化注解

- UserFeedbackForm中创建时间与更新时间字段添加@DateTimeFormat注解
- UserOrderInfoQuery中开始时间与结束时间字段添加@JsonFormat和@DateTimeFormat注解
- 统一时间字段的日期时间格式为"yyyy-MM-dd HH:mm:ss"
- 新增必要的Spring格式化注解import声明
wzq 3 viikkoa sitten
vanhempi
commit
8467ef5ffb

+ 3 - 0
src/main/java/com/zsElectric/boot/business/model/form/UserFeedbackForm.java

@@ -8,6 +8,7 @@ import lombok.Setter;
 import java.time.LocalDateTime;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.*;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 用户反馈表单对象
@@ -57,6 +58,7 @@ public class UserFeedbackForm implements Serializable {
 
     @Schema(description = "创建时间")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
     @Schema(description = "创建人ID")
@@ -64,6 +66,7 @@ public class UserFeedbackForm implements Serializable {
 
     @Schema(description = "更新时间")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime updateTime;
 
     @Schema(description = "更新人ID")

+ 6 - 0
src/main/java/com/zsElectric/boot/business/model/query/UserOrderInfoQuery.java

@@ -1,9 +1,11 @@
 package com.zsElectric.boot.business.model.query;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zsElectric.boot.common.base.BasePageQuery;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
@@ -32,8 +34,12 @@ public class UserOrderInfoQuery extends BasePageQuery {
     private String orderNo;
 
     @Schema(description = "开始时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime startTime;
 
     @Schema(description = "结束时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime endTime;
 }