This commit is contained in:
韩鹏辉 2023-08-03 09:46:01 +08:00
parent 50f1997218
commit 4270d3647b
6 changed files with 216 additions and 0 deletions

BIN
newadmin/admin/admin.jar Normal file

Binary file not shown.

38
newadmin/common-api/.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,101 @@
package com.chaozhanggui.common.system.config;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.List;
/**
* 一般异常信息的异常全局捕获会抛出异常信息给前端
* @author Djh
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MsgException extends RuntimeException {
private final Serializable obj;
private final String code;
public MsgException(String msg) {
this(msg, null);
}
public MsgException(String msg, Serializable obj) {
this(RespBody.fail, msg, obj);
}
public MsgException(String code, String msg, Serializable obj) {
super(msg);
this.code = code;
this.obj = obj;
}
public static void throwException(String msg) throws MsgException {
throw new MsgException(msg);
}
/**
* @param result
* @param errMsg
*
* @throws MsgException 为空的时候抛出异常
*/
public static void check(boolean result, String errMsg) throws MsgException {
if (result) {
throw new MsgException(errMsg);
}
}
/**
* @param obj1
* @param errMsg
*/
public static void checkNull(Object obj1, String errMsg) throws MsgException {
if (obj1 == null) {
throw new MsgException(errMsg);
}
}
public static void checkEquals(Object obj1, Object obj2, String errMsg) {
if (obj1.equals(obj2)) {
throw new MsgException(errMsg);
}
}
public static void checkUnequals(Object obj1, Object obj2, String errMsg) {
if (!obj1.equals(obj2)) {
throw new MsgException(errMsg);
}
}
public static void checkNonNull(Object obj1, String errMsg) throws MsgException {
if (obj1 != null) {
throw new MsgException(errMsg);
}
}
public static void checkBlank(String field, String errMsg) throws MsgException {
if (StringUtils.isBlank(field)) {
throw new MsgException(errMsg);
}
}
public static <T> void checkBlank(List<T> dataList, String errMsg) throws MsgException {
if (dataList == null || dataList.isEmpty()) {
throw new MsgException(errMsg);
}
}
public static <T> void checkNonBlank(List<T> dataList, String errMsg) throws MsgException {
if (dataList != null && !dataList.isEmpty()) {
throw new MsgException(errMsg);
}
}
}

View File

@ -9,6 +9,7 @@ import java.util.Objects;
//命名区别于ResponseBody注解
public class RespBody {
public static String fail="400";
private static Logger logger = LoggerFactory.getLogger(RespBody.class);
private String code;
private String message;

38
newadmin/dao-api/.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store