Compare commits
11 Commits
2a3b15dfca
...
262c8d1092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
262c8d1092 | ||
|
|
89909b0992 | ||
|
|
8cdf5f637a | ||
|
|
8935688a08 | ||
|
|
30231995da | ||
|
|
92d4943db8 | ||
|
|
33a2d670ba | ||
|
|
9528e02fa5 | ||
|
|
e35c5be08d | ||
|
|
9bee77a86a | ||
|
|
3a04a32fe3 |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
### 预览
|
### 预览
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[Demo](https://demo.besscroft.com/)
|
[Demo](https://demo.besscroft.com/)
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class OpenApiConfiguration {
|
|||||||
return new OpenAPI()
|
return new OpenAPI()
|
||||||
.info(new Info().title("DiyFile")
|
.info(new Info().title("DiyFile")
|
||||||
.description("一款好看的在线文件列表程序")
|
.description("一款好看的在线文件列表程序")
|
||||||
.version("v0.8.1")
|
.version("v0.8.3")
|
||||||
.license(new License().name("MIT license").url("https://github.com/besscroft/diyfile/blob/main/LICENSE")))
|
.license(new License().name("MIT license").url("https://github.com/besscroft/diyfile/blob/main/LICENSE")))
|
||||||
.externalDocs(new ExternalDocumentation()
|
.externalDocs(new ExternalDocumentation()
|
||||||
.description("DiyFile 文档")
|
.description("DiyFile 文档")
|
||||||
|
|||||||
@@ -71,6 +71,10 @@
|
|||||||
<groupId>org.flywaydb</groupId>
|
<groupId>org.flywaydb</groupId>
|
||||||
<artifactId>flyway-core</artifactId>
|
<artifactId>flyway-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flywaydb</groupId>
|
||||||
|
<artifactId>flyway-mysql</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- aws-java-sdk-s3 -->
|
<!-- aws-java-sdk-s3 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>software.amazon.awssdk</groupId>
|
<groupId>software.amazon.awssdk</groupId>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.flywaydb.core.api.FlywayException;
|
|||||||
import org.flywaydb.core.internal.database.DatabaseType;
|
import org.flywaydb.core.internal.database.DatabaseType;
|
||||||
import org.flywaydb.core.internal.exception.FlywaySqlException;
|
import org.flywaydb.core.internal.exception.FlywaySqlException;
|
||||||
import org.flywaydb.core.internal.plugin.PluginRegister;
|
import org.flywaydb.core.internal.plugin.PluginRegister;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@@ -37,6 +38,9 @@ public class FlywayConfigure {
|
|||||||
private static final List<DatabaseType> SORTED_DATABASE_TYPES = new PluginRegister().getPlugins(DatabaseType.class).stream().sorted().collect(Collectors.toList());
|
private static final List<DatabaseType> SORTED_DATABASE_TYPES = new PluginRegister().getPlugins(DatabaseType.class).stream().sorted().collect(Collectors.toList());
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Value("${spring.flyway.enabled}")
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void flywayMigrate() {
|
public void flywayMigrate() {
|
||||||
String datasourceDriveClassName = applicationContext.getEnvironment().getProperty("spring.datasource.driver-class-name");
|
String datasourceDriveClassName = applicationContext.getEnvironment().getProperty("spring.datasource.driver-class-name");
|
||||||
@@ -54,6 +58,10 @@ public class FlywayConfigure {
|
|||||||
log.info("sqlite 数据库文件已存在,路径:{}", folderPath);
|
log.info("sqlite 数据库文件已存在,路径:{}", folderPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!enabled) {
|
||||||
|
log.info("flyway 已关闭,跳过初始化...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
String databaseProductName = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
String databaseProductName = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
||||||
String dbType = databaseProductName.toLowerCase(Locale.ROOT);
|
String dbType = databaseProductName.toLowerCase(Locale.ROOT);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.besscroft.diyfile.controller;
|
package com.besscroft.diyfile.controller;
|
||||||
|
|
||||||
|
import com.besscroft.diyfile.common.constant.MessageConstants;
|
||||||
import com.besscroft.diyfile.common.param.sync.SyncTaskParam;
|
import com.besscroft.diyfile.common.param.sync.SyncTaskParam;
|
||||||
import com.besscroft.diyfile.common.result.CommonResult;
|
import com.besscroft.diyfile.common.result.CommonResult;
|
||||||
import com.besscroft.diyfile.common.util.PathUtils;
|
import com.besscroft.diyfile.common.util.PathUtils;
|
||||||
@@ -34,7 +35,7 @@ public class SyncController {
|
|||||||
PathUtils.decode(param.getBeforePath()),
|
PathUtils.decode(param.getBeforePath()),
|
||||||
param.getAfterStorageKey(),
|
param.getAfterStorageKey(),
|
||||||
PathUtils.decode(param.getAfterPath()));
|
PathUtils.decode(param.getAfterPath()));
|
||||||
return CommonResult.success();
|
return CommonResult.success(MessageConstants.ADD_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class UserController {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public CommonResult<Void> add(@RequestBody @Valid UserAddParam param) {
|
public CommonResult<Void> add(@RequestBody @Valid UserAddParam param) {
|
||||||
userService.addUser(param);
|
userService.addUser(param);
|
||||||
return CommonResult.success();
|
return CommonResult.success(MessageConstants.ADD_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "用户更新接口")
|
@Operation(summary = "用户更新接口")
|
||||||
@@ -106,7 +106,7 @@ public class UserController {
|
|||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public CommonResult<Void> update(@RequestBody @Valid UserUpdateParam param) {
|
public CommonResult<Void> update(@RequestBody @Valid UserUpdateParam param) {
|
||||||
userService.updateUser(param);
|
userService.updateUser(param);
|
||||||
return CommonResult.success();
|
return CommonResult.success(MessageConstants.UPDATE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "用户查询接口")
|
@Operation(summary = "用户查询接口")
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class StorageServiceImpl extends ServiceImpl<StorageMapper, Storage> impl
|
|||||||
CacheConstants.ENABLE_STORAGE,
|
CacheConstants.ENABLE_STORAGE,
|
||||||
CacheConstants.STATISTICS
|
CacheConstants.STATISTICS
|
||||||
}, allEntries = true)
|
}, allEntries = true)
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteStorage(Long storageId) {
|
public void deleteStorage(Long storageId) {
|
||||||
Assert.isTrue(this.baseMapper.deleteById(storageId) > 0, "存储删除失败!");
|
Assert.isTrue(this.baseMapper.deleteById(storageId) > 0, "存储删除失败!");
|
||||||
Assert.isTrue(storageConfigMapper.deleteByStorageId(storageId) > 0, "存储删除失败!");
|
Assert.isTrue(storageConfigMapper.deleteByStorageId(storageId) > 0, "存储删除失败!");
|
||||||
@@ -154,6 +155,7 @@ public class StorageServiceImpl extends ServiceImpl<StorageMapper, Storage> impl
|
|||||||
CacheConstants.ENABLE_STORAGE,
|
CacheConstants.ENABLE_STORAGE,
|
||||||
CacheConstants.STATISTICS
|
CacheConstants.STATISTICS
|
||||||
}, allEntries = true)
|
}, allEntries = true)
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateStatus(Long storageId, Integer status) {
|
public void updateStatus(Long storageId, Integer status) {
|
||||||
Storage storage = this.baseMapper.selectById(storageId);
|
Storage storage = this.baseMapper.selectById(storageId);
|
||||||
Assert.notNull(storage, "存储不存在!");
|
Assert.notNull(storage, "存储不存在!");
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, Sys
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@CacheEvict(value = {
|
@CacheEvict(value = {
|
||||||
CacheConstants.SYSTEM_CONFIG,
|
CacheConstants.SYSTEM_CONFIG,
|
||||||
CacheConstants.SITE_TITLE,
|
CacheConstants.SITE_TITLE,
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void addUser(UserAddParam param) {
|
public void addUser(UserAddParam param) {
|
||||||
User user = UserConverterMapper.INSTANCE.AddParamToUser(param);
|
User user = UserConverterMapper.INSTANCE.AddParamToUser(param);
|
||||||
if (Objects.equals(user.getRole(), RoleConstants.PLATFORM_SUPER_ADMIN)) {
|
if (Objects.equals(user.getRole(), RoleConstants.PLATFORM_SUPER_ADMIN)) {
|
||||||
@@ -154,6 +153,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
CacheConstants.USER,
|
CacheConstants.USER,
|
||||||
CacheConstants.STATISTICS
|
CacheConstants.STATISTICS
|
||||||
}, allEntries = true)
|
}, allEntries = true)
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateStatus(Long id, Integer status) {
|
public void updateStatus(Long id, Integer status) {
|
||||||
User user = this.baseMapper.selectById(id);
|
User user = this.baseMapper.selectById(id);
|
||||||
Assert.notNull(user, "用户不存在!");
|
Assert.notNull(user, "用户不存在!");
|
||||||
|
|||||||
BIN
doc/images/diyfile-demo.png
Normal file
BIN
doc/images/diyfile-demo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
BIN
doc/images/diyfile.png
Normal file
BIN
doc/images/diyfile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
14
pom.xml
14
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.4</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@@ -17,24 +17,24 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>0.8.1</revision>
|
<revision>0.8.3</revision>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<maven.compiler.release>17</maven.compiler.release>
|
<maven.compiler.release>17</maven.compiler.release>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<spring-boot.version>3.1.2</spring-boot.version>
|
<spring-boot.version>3.1.4</spring-boot.version>
|
||||||
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
||||||
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
|
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
|
||||||
<mybatis-plus.version>3.5.3.2</mybatis-plus.version>
|
<mybatis-plus.version>3.5.3.2</mybatis-plus.version>
|
||||||
<springdoc.version>2.2.0</springdoc.version>
|
<springdoc.version>2.2.0</springdoc.version>
|
||||||
<sa-token.version>1.34.0</sa-token.version>
|
<sa-token.version>1.36.0</sa-token.version>
|
||||||
<hutool-all.version>5.8.20</hutool-all.version>
|
<hutool-all.version>5.8.20</hutool-all.version>
|
||||||
<pagehelper.version>1.4.7</pagehelper.version>
|
<pagehelper.version>1.4.7</pagehelper.version>
|
||||||
<oshi.version>6.4.4</oshi.version>
|
<oshi.version>6.4.4</oshi.version>
|
||||||
<okhttps.version>3.5.3</okhttps.version>
|
<okhttps.version>3.5.3</okhttps.version>
|
||||||
<caffeine.version>3.1.7</caffeine.version>
|
<caffeine.version>3.1.8</caffeine.version>
|
||||||
<aliyun-sdk-oss.version>3.17.1</aliyun-sdk-oss.version>
|
<aliyun-sdk-oss.version>3.17.1</aliyun-sdk-oss.version>
|
||||||
<jaxb-api.version>2.3.1</jaxb-api.version>
|
<jaxb-api.version>2.3.1</jaxb-api.version>
|
||||||
<activation.version>1.1.1</activation.version>
|
<activation.version>1.1.1</activation.version>
|
||||||
@@ -73,6 +73,10 @@
|
|||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user