Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rel_ai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨阔
rel_ai
Commits
457ab06b
You need to sign in or sign up before continuing.
Commit
457ab06b
authored
Apr 30, 2026
by
杨阔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改客户信息创建时间实现方式
parent
74d88477
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
Customer.java
src/main/java/com/example/customervisit/entity/Customer.java
+6
-8
No files found.
src/main/java/com/example/customervisit/entity/Customer.java
View file @
457ab06b
package
com
.
example
.
customervisit
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
jakarta.persistence.*
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
java.time.LocalDateTime
;
...
...
@@ -282,23 +286,18 @@ public class Customer {
@Column
(
name
=
"region_second_manager_code"
,
length
=
50
)
private
String
regionSecondManagerCode
;
@CreationTimestamp
@Column
(
name
=
"created_at"
)
private
LocalDateTime
createdAt
;
@UpdateTimestamp
@Column
(
name
=
"updated_at"
)
private
LocalDateTime
updatedAt
;
@PrePersist
protected
void
onCreate
()
{
createdAt
=
LocalDateTime
.
now
(
java
.
time
.
ZoneId
.
of
(
"Asia/Shanghai"
));
updatedAt
=
LocalDateTime
.
now
(
java
.
time
.
ZoneId
.
of
(
"Asia/Shanghai"
));
if
(
id
==
null
||
id
.
isEmpty
())
{
id
=
String
.
valueOf
(
System
.
currentTimeMillis
());
}
}
@PreUpdate
protected
void
onUpdate
()
{
updatedAt
=
LocalDateTime
.
now
(
java
.
time
.
ZoneId
.
of
(
"Asia/Shanghai"
));
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment