feat: 添加数据库支持,保存测算记录
- 添加Spring Data JPA和H2/MySQL数据库依赖 - 创建DeductRecord实体类,保存测算记录 - 创建DeductRecordRepository和DeductRecordService - 创建RecordController,提供记录查询和删除API - 修改BaZiController,保存测算结果到数据库 - 配置H2数据库用于开发,MySQL用于生产环境
This commit is contained in:
1 parent
251a49d810
commit
683f55e4ca
7 files changed
+338
No files matched your search
@@ -1,2 +1,30 @@
|
||||
server.port=8080
|
||||
spring.application.name=xuan-utils-pro
|
||||
|
||||
# H2 Database Configuration (Development)
|
||||
spring.datasource.url=jdbc:h2:file:./data/xuan;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE
|
||||
spring.datasource.driverClassName=org.h2.Driver
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=
|
||||
|
||||
# JPA Configuration
|
||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.show-sql=true
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
|
||||
# H2 Console (Development only)
|
||||
spring.h2.console.enabled=true
|
||||
spring.h2.console.path=/h2-console
|
||||
|
||||
# MySQL Configuration (Production - uncomment when needed)
|
||||
#spring.datasource.url=jdbc:mysql://localhost:3306/xuan_deduct?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf8
|
||||
#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
#spring.datasource.username=root
|
||||
#spring.datasource.password=your_password
|
||||
#spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
|
||||
#spring.jpa.hibernate.ddl-auto=update
|
||||
|
||||
# Logging
|
||||
logging.level.xuan=DEBUG
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
Reference in new issue
Block a user