Skip to content

Commit

Permalink
增加 Java 笔记。
Browse files Browse the repository at this point in the history
  • Loading branch information
Suomea committed Dec 23, 2024
1 parent 99795f6 commit afb0407
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 16 deletions.
61 changes: 45 additions & 16 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,44 @@
"state": {
"type": "markdown",
"state": {
"file": "docs/MySQL/MySQL 配置主从.md",
"file": "docs/Redis/Redis 数据结构.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "MySQL 配置主从"
"title": "Redis 数据结构"
}
},
{
"id": "54a6a2097fcd82ce",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "docs/Linux/未命名.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "未命名"
}
},
{
"id": "70e320b58f86b1d6",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "docs/Java/日期时间操作.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "日期时间操作"
}
}
],
"currentTab": 1
"currentTab": 3
}
],
"direction": "vertical"
Expand Down Expand Up @@ -88,7 +116,8 @@
"title": "书签"
}
}
]
],
"currentTab": 1
}
],
"direction": "horizontal",
Expand Down Expand Up @@ -179,11 +208,21 @@
"vscode-editor:新建代码文件": false
}
},
"active": "6946aa7c05144594",
"active": "c3e1cd9fa3752c91",
"lastOpenFiles": [
"docs/Java/Tips.md",
"docs/Java/日期时间操作.md",
"docs/Linux/未命名.md",
"docs/Redis/Redis 数据结构.md",
"docs/Redis/Redis 安装.md",
"docs/Redis/Redis 分布式锁.md",
"docs/MySQL/MySQL 备份.md",
"docs/MySQL/MySQL 配置主从.md",
"docs/MySQL/MySQL 安装.md",
"docs/Kafka/Kafka 快速开始.md",
"docs/Kafka/Kafka 常用命令.md",
"docs/Kafka/Kafka 集群搭建.md",
"docs/Kafka/Kafka Tips.md",
"docs/MySQL/MySQL 配置主从.md",
"docs/Linux/运维监控.md",
"docs/MySQL/MySQL 系统和状态变量.md",
"docs/Linux/ls.md",
Expand All @@ -198,16 +237,6 @@
"docs/Linux/Git.md",
"docs/Linux/curl.md",
"docs/Linux/ArcLinux 安装.md",
"docs/Linux/正则表达式.md",
"docs/Linux/时间.md",
"docs/Linux/查找文件.md",
"docs/Kafka/Kafka 配置.md",
"docs/Kafka/Kafka 快速开始.md",
"docs/Kafka/Kafka Tips.md",
"docs/Kafka/Kafka 集群搭建.md",
"docs/Kafka/Kafka 常用命令.md",
"docs/Linux/VIM.md",
"docs/Server/本地服务器192.168.31.11.md",
"mkdocs.yml",
"overrides/partials/comments.html",
"overrides/partials/footer.html",
Expand Down
18 changes: 18 additions & 0 deletions docs/Java/日期时间操作.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Spring boot 通过 @RequestParam 接收 LocalDateTime
```java
@GetMapping("test")
public R<?> test(
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
···
}
```

获取两个 LocalDateTime 之间的间隔
```java
Duration duration = Duration.between(startTime, endTime);
duration.toDays();
duration.toHours();
duration.toMinutes();
duration.getSeconds();
```
Empty file added docs/Linux/未命名.md
Empty file.
7 changes: 7 additions & 0 deletions docs/MySQL/MySQL 配置主从.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ character-set-server = utf8mb4
max_connections = 2000
```

配置从库只同步主库的部分数据库:
```
[mysqld]
replicate-do-db=database1
replicate-do-db=database2
```

配置主库信息:
```sql
CHANGE REPLICATION SOURCE TO
Expand Down

0 comments on commit afb0407

Please sign in to comment.