Browse Source

update

for_java17
许孟阳 3 years ago
parent
commit
1ae24b874c
  1. 6
      pom.xml
  2. 11
      src/main/java/vip/xumy/core/exception/ControllerExceptionHandler.java

6
pom.xml

@ -47,12 +47,6 @@ @@ -47,12 +47,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- spring-boot整合mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>

11
src/main/java/vip/xumy/core/exception/ControllerExceptionHandler.java

@ -4,7 +4,6 @@ import java.sql.SQLException; @@ -4,7 +4,6 @@ import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ -28,11 +27,11 @@ public class ControllerExceptionHandler { @@ -28,11 +27,11 @@ public class ControllerExceptionHandler {
return new AjaxResponse(false, e.getMessage());
}
@ResponseBody
@ExceptionHandler(DuplicateKeyException.class)
public AjaxResponse handlerDuplicateKeyException(DuplicateKeyException e) {
return new AjaxResponse(false, "数据已存在,请勿重复添加");
}
// @ResponseBody
// @ExceptionHandler(DuplicateKeyException.class)
// public AjaxResponse handlerDuplicateKeyException(DuplicateKeyException e) {
// return new AjaxResponse(false, "数据已存在,请勿重复添加");
// }
@ResponseBody
@ExceptionHandler(SQLException.class)

Loading…
Cancel
Save