From c0ade4a0fdde8e13c2daaf5afbf96ab0a2628ead Mon Sep 17 00:00:00 2001 From: zichun Date: Fri, 8 May 2026 12:37:22 +0800 Subject: [PATCH] chore(usr): 配置 checkstyle.xml 并修复 5 处 lint 违规 --- backend/checkstyle.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ backend/pom.xml | 10 ++++++++++ backend/src/main/java/com/example/erp/Application.java | 1 - backend/src/main/java/com/example/erp/common/exception/GlobalExceptionHandler.java | 2 -- backend/src/main/java/com/example/erp/module/usr/controller/AuthController.java | 6 +++++- backend/src/main/java/com/example/erp/module/usr/controller/UserController.java | 9 ++++++++- 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 backend/checkstyle.xml diff --git a/backend/checkstyle.xml b/backend/checkstyle.xml new file mode 100644 index 0000000..2bfbd05 --- /dev/null +++ b/backend/checkstyle.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/pom.xml b/backend/pom.xml index 44ebf24..38a77f4 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -122,6 +122,16 @@ org.apache.maven.plugins + maven-checkstyle-plugin + + checkstyle.xml + true + true + false + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/backend/src/main/java/com/example/erp/Application.java b/backend/src/main/java/com/example/erp/Application.java index 5748201..32927cc 100644 --- a/backend/src/main/java/com/example/erp/Application.java +++ b/backend/src/main/java/com/example/erp/Application.java @@ -2,7 +2,6 @@ package com.example.erp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.context.properties.EnableConfigurationProperties; @SpringBootApplication public class Application { diff --git a/backend/src/main/java/com/example/erp/common/exception/GlobalExceptionHandler.java b/backend/src/main/java/com/example/erp/common/exception/GlobalExceptionHandler.java index 64d4d2a..3a6e523 100644 --- a/backend/src/main/java/com/example/erp/common/exception/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/example/erp/common/exception/GlobalExceptionHandler.java @@ -2,11 +2,9 @@ package com.example.erp.common.exception; import com.example.erp.common.response.Result; import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; import org.springframework.validation.FieldError; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; @Slf4j diff --git a/backend/src/main/java/com/example/erp/module/usr/controller/AuthController.java b/backend/src/main/java/com/example/erp/module/usr/controller/AuthController.java index 851b726..acbb01d 100644 --- a/backend/src/main/java/com/example/erp/module/usr/controller/AuthController.java +++ b/backend/src/main/java/com/example/erp/module/usr/controller/AuthController.java @@ -8,7 +8,11 @@ import com.example.erp.module.usr.vo.BrandVO; import com.example.erp.module.usr.vo.LoginVO; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; diff --git a/backend/src/main/java/com/example/erp/module/usr/controller/UserController.java b/backend/src/main/java/com/example/erp/module/usr/controller/UserController.java index 19260be..c556d68 100644 --- a/backend/src/main/java/com/example/erp/module/usr/controller/UserController.java +++ b/backend/src/main/java/com/example/erp/module/usr/controller/UserController.java @@ -15,7 +15,14 @@ import com.example.erp.module.usr.vo.UserUpdateRespVO; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.security.core.annotation.AuthenticationPrincipal; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import java.util.List; -- libgit2 0.22.2