com.pongsky.kit.common.exception.InsertException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-common Show documentation
Show all versions of spring-boot-starter-common Show documentation
Java 增强套件 之 公共 Spring Boot Starter 模块
The newest version!
package com.pongsky.kit.common.exception;
/**
* 保存异常
*
* @author pengsenhao
*/
public class InsertException extends RuntimeException {
private static final long serialVersionUID = -4776662733913410838L;
public InsertException(String message) {
super(message);
}
/**
* 校验保存 SQL
*
* @param exceptionMessage 异常信息
* @param result 结果
*/
public static void validation(String exceptionMessage, Boolean result) {
if (!result) {
throw new InsertException(exceptionMessage);
}
}
/**
* 校验保存 SQL
*
* @param exceptionMessage 异常信息
* @param insertCount 保存总数
*/
public static void validation(String exceptionMessage, Integer insertCount) {
validation(exceptionMessage, insertCount, 1);
}
/**
* 校验保存 SQL
*
* @param exceptionMessage 异常信息
* @param insertCount 保存总数
* @param dataCount 数据总数
*/
public static void validation(String exceptionMessage, Integer insertCount, Integer dataCount) {
if (!insertCount.equals(dataCount)) {
throw new InsertException(exceptionMessage);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy