This commit is contained in:
wu 2024-11-11 08:01:26 +08:00
parent bddbc01a24
commit 11aab361e1
4 changed files with 36 additions and 37 deletions

View File

@ -15,13 +15,13 @@ public class User {
@Column(nullable = false)
private String password;
@Column()
private String email;
@Column
private String phone;
@Column
private Integer age;
public String getName() {

View File

@ -30,7 +30,6 @@ public class UserService {
public User updateUser(Long id, User user){
userRepository.findById(id).ifPresent(u->{
// u.setName(user.getName());
u.setPassword(user.getPassword());
u.setEmail(user.getEmail());
u.setPhone(user.getPhone());

View File

@ -1,42 +1,42 @@
spring:
jackson:
property-naming-strategy: SNAKE_CASE # 驼峰转下划线
datasource:
url: jdbc:mysql://localhost:3306/demo?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true # MySQL连接URLpaopao是数据库名
driverClassName: com.mysql.cj.jdbc.Driver # MySQL的Driver类名
username: root # MySQL用户名
password: root # MySQL密码
jpa:
show-sql: true
open-in-view: false
defer-datasource-initialization: true
database-platform: org.hibernate.dialect.MySQL8Dialect # 修改为MySQL的Dialect
hibernate:
ddl-auto: update # 根据需要调整update适用于开发和某些生产环境
format_sql: true # 保持原样用于格式化SQL输出
#
#spring:
#
# jackson:
# property-naming-strategy: SNAKE_CASE # 驼峰转下划线
#
# datasource:
# url: jdbc:h2:file:./demo.h2 # 使用文件存储
# driverClassName: org.h2.Driver
# username: root
# password: root
# h2:
# console: # 开启console访问 默认false
# enabled: true
# settings:
# trace: true # 开启h2 console 跟踪 方便调试 默认 false
# web-allow-others: true # 允许console 远程访问 默认false
# path: /h2 # h2 访问路径上下文
# url: jdbc:mysql://localhost:3306/demo?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true # MySQL连接URLpaopao是数据库名
# driverClassName: com.mysql.cj.jdbc.Driver # MySQL的Driver类名
# username: root # MySQL用户名
# password: root # MySQL密码
# jpa:
# show-sql: true
# open-in-view: false
# defer-datasource-initialization: true
# database-platform: org.hibernate.dialect.H2Dialect
# database-platform: org.hibernate.dialect.MySQL8Dialect # 修改为MySQL的Dialect
# hibernate:
# ddl-auto: update
# ddl-auto: update # 根据需要调整update适用于开发和某些生产环境
# format_sql: true # 保持原样用于格式化SQL输出
spring:
jackson:
property-naming-strategy: SNAKE_CASE # 驼峰转下划线
datasource:
url: jdbc:h2:file:./db.h2 # 使用文件存储
driverClassName: org.h2.Driver
username: root
password: root
h2:
console: # 开启console访问 默认false
enabled: true
settings:
trace: true # 开启h2 console 跟踪 方便调试 默认 false
web-allow-others: true # 允许console 远程访问 默认false
path: /h2 # h2 访问路径上下文
jpa:
show-sql: true
open-in-view: false
defer-datasource-initialization: true
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: update