diff --git a/pom.xml b/pom.xml
index 1290dc9..5074634 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,10 @@
org.springframework.boot
spring-boot-starter-validation
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
com.fasterxml.jackson.module
jackson-module-kotlin
diff --git a/src/main/kotlin/top/fatweb/api/controller/system/SettingController.kt b/src/main/kotlin/top/fatweb/api/controller/system/SettingController.kt
new file mode 100644
index 0000000..b8ba719
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/controller/system/SettingController.kt
@@ -0,0 +1,32 @@
+package top.fatweb.api.controller.system
+
+import io.swagger.v3.oas.annotations.Operation
+import io.swagger.v3.oas.annotations.tags.Tag
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+import top.fatweb.api.entity.common.ResponseResult
+import top.fatweb.api.param.system.SettingParam
+import top.fatweb.api.service.system.ISysSettingService
+import top.fatweb.api.vo.system.SettingVo
+
+/**
+ * System setting controller
+ *
+ * @author FatttSnake, fatttsnake@gmail.com
+ * @since 1.0.0
+ */
+@Tag(name = "系统设置", description = "系统设置相关接口")
+@RequestMapping("/system/setting")
+@RestController
+class SettingController(
+ private val sysSettingService: ISysSettingService
+) {
+ @Operation(summary = "获取")
+ fun get(): ResponseResult = ResponseResult.success(data = sysSettingService.get())
+
+ @Operation(summary = "更新")
+ fun update(settingParam: SettingParam): ResponseResult {
+ sysSettingService.update(settingParam)
+ return ResponseResult.success()
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/converter/system/SettingConverter.kt b/src/main/kotlin/top/fatweb/api/converter/system/SettingConverter.kt
new file mode 100644
index 0000000..5a920fa
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/converter/system/SettingConverter.kt
@@ -0,0 +1,32 @@
+package top.fatweb.api.converter.system
+
+import top.fatweb.api.param.system.SettingParam
+import top.fatweb.api.setting.MailSetting
+import top.fatweb.api.setting.SystemSetting
+import top.fatweb.api.vo.system.SettingVo
+
+object SettingConverter {
+ fun mailSettingToMailSettingVo(mailSetting: MailSetting) = SettingVo.MailSettingVo(
+ host = mailSetting.host,
+ port = mailSetting.port,
+ username = mailSetting.username,
+ password = mailSetting.password,
+ from = mailSetting.from
+ )
+
+ fun systemSettingToSettingVo(sysSetting: SystemSetting) = SettingVo(
+ mail = sysSetting.mail?.let { mailSettingToMailSettingVo(it) }
+ )
+
+ fun mailSettingParamToMailSetting(mailSettingParam: SettingParam.MailSettingParam) = MailSetting(
+ host = mailSettingParam.host,
+ port = mailSettingParam.port,
+ username = mailSettingParam.username,
+ password = mailSettingParam.password,
+ from = mailSettingParam.from
+ )
+
+ fun settingParamToSystemSetting(settingParam: SettingParam) = SystemSetting(
+ mail = settingParam.mail?.let { mailSettingParamToMailSetting(it) }
+ )
+}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/param/system/SettingParam.kt b/src/main/kotlin/top/fatweb/api/param/system/SettingParam.kt
new file mode 100644
index 0000000..f98b4ae
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/param/system/SettingParam.kt
@@ -0,0 +1,13 @@
+package top.fatweb.api.param.system
+
+data class SettingParam (
+ val mail: MailSettingParam?
+) {
+ data class MailSettingParam (
+ val host: String,
+ val port: Int,
+ val username: String,
+ val password: String,
+ val from: String
+ )
+}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/service/system/ISysSettingService.kt b/src/main/kotlin/top/fatweb/api/service/system/ISysSettingService.kt
new file mode 100644
index 0000000..2cea670
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/service/system/ISysSettingService.kt
@@ -0,0 +1,10 @@
+package top.fatweb.api.service.system
+
+import top.fatweb.api.param.system.SettingParam
+import top.fatweb.api.vo.system.SettingVo
+
+interface ISysSettingService {
+ fun get(): SettingVo
+
+ fun update(settingParam: SettingParam)
+}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/service/system/impl/SysSettingServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/system/impl/SysSettingServiceImpl.kt
new file mode 100644
index 0000000..50c32c9
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/service/system/impl/SysSettingServiceImpl.kt
@@ -0,0 +1,17 @@
+package top.fatweb.api.service.system.impl
+
+import org.springframework.stereotype.Service
+import top.fatweb.api.param.system.SettingParam
+import top.fatweb.api.service.system.ISysSettingService
+import top.fatweb.api.vo.system.SettingVo
+
+@Service
+class SysSettingServiceImpl : ISysSettingService {
+ override fun get(): SettingVo {
+ TODO("Not yet implemented")
+ }
+
+ override fun update(settingParam: SettingParam) {
+ TODO("Not yet implemented")
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/setting/MailSetting.kt b/src/main/kotlin/top/fatweb/api/setting/MailSetting.kt
new file mode 100644
index 0000000..1b993ce
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/setting/MailSetting.kt
@@ -0,0 +1,9 @@
+package top.fatweb.api.setting
+
+data class MailSetting(
+ var host: String? = null,
+ var port: Int? = null,
+ var username: String? = null,
+ var password: String? = null,
+ var from: String? = null,
+)
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/setting/SettingOperator.kt b/src/main/kotlin/top/fatweb/api/setting/SettingOperator.kt
new file mode 100644
index 0000000..c01b5dc
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/setting/SettingOperator.kt
@@ -0,0 +1,31 @@
+package top.fatweb.api.setting
+
+import com.fasterxml.jackson.dataformat.yaml.YAMLMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import java.io.File
+import java.io.IOException
+
+object SettingOperator {
+ const val SETTING_FILE_NAME = "data/config/setting.yaml"
+ private val yamlMapper = YAMLMapper()
+
+ var systemSetting: SystemSetting? = null
+
+ fun init() {
+
+ }
+
+ fun getFromSettingFile(): SystemSetting {
+ val settingFile = File(SETTING_FILE_NAME)
+ if (!settingFile.isFile) {
+ if (!settingFile.parentFile.isDirectory) {
+ if (!settingFile.parentFile.mkdirs()) {
+ throw IOException("Can not make directory: ${settingFile.parentFile.absolutePath}")
+ }
+ }
+ settingFile.delete()
+ settingFile.createNewFile()
+ }
+ return yamlMapper.readValue(settingFile)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/api/setting/SystemSetting.kt b/src/main/kotlin/top/fatweb/api/setting/SystemSetting.kt
new file mode 100644
index 0000000..4dbe09e
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/setting/SystemSetting.kt
@@ -0,0 +1,5 @@
+package top.fatweb.api.setting
+
+data class SystemSetting(
+ var mail: MailSetting? = null
+)
diff --git a/src/main/kotlin/top/fatweb/api/vo/system/SettingVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/SettingVo.kt
new file mode 100644
index 0000000..ba5e9c5
--- /dev/null
+++ b/src/main/kotlin/top/fatweb/api/vo/system/SettingVo.kt
@@ -0,0 +1,13 @@
+package top.fatweb.api.vo.system
+
+data class SettingVo(
+ val mail: MailSettingVo?
+) {
+ data class MailSettingVo(
+ val host: String?,
+ val port: Int?,
+ val username: String?,
+ val password: String?,
+ val from: String?
+ )
+}
\ No newline at end of file