feat(grouping): 新增分组功能并优化 Markdown 文件操作

- 新增分组实体、控制器、服务和映射器
- 实现分组创建、获取、更新和删除接口
- 优化 Markdown 文件创建、获取和删除接口- 新增全局异常处理和日志记录
- 更新数据库表结构和字段类型
- 重构前端页面,支持分组和 Markdown 文件展示
This commit is contained in:
ikmkj
2025-06-17 20:46:10 +08:00
parent 8b43b68e62
commit 4557bd49f9
29 changed files with 4286 additions and 97 deletions

View File

@@ -5,6 +5,8 @@ import com.test.bijihoudaun.common.exception.BaseException;
import com.test.bijihoudaun.common.response.R;
import com.test.bijihoudaun.common.response.ResultCode;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -20,6 +22,8 @@ import java.util.stream.Collectors;
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
// 打印日志
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
* 处理业务异常
@@ -34,6 +38,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(MaxUploadSizeExceededException.class)
public R<String> handleFileSizeLimitExceeded() {
log.error("文件大小超出限制");
return R.fail("文件大小超过限制");
}
@@ -46,6 +51,7 @@ public class GlobalExceptionHandler {
.stream()
.map(FieldError::getDefaultMessage)
.collect(Collectors.toList());
log.error("参数校验异常:{}", errors.get(0));
return R.fail(ResultCode.VALIDATE_FAILED.getCode(), errors.get(0));
}
@@ -58,6 +64,7 @@ public class GlobalExceptionHandler {
.stream()
.map(FieldError::getDefaultMessage)
.collect(Collectors.toList());
log.error("参数校验异常:{}", errors.get(0));
return R.fail(ResultCode.VALIDATE_FAILED.getCode(), errors.get(0));
}
@@ -66,6 +73,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(Exception.class)
public R<Void> handleException(Exception e) {
return R.fail(ResultCode.FAILED.getCode(), "系统繁忙,请稍后再试");
log.error("系统异常:{}", e.getMessage());
return R.fail(ResultCode.FAILED.getCode(), "系统繁忙,请稍后再试:" + e.getMessage());
}
}