All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pongsky.kit.exception.InsertException Maven / Gradle / Ivy

There is a newer version: 3.10.1-2.4.13
Show newest version
package com.pongsky.kit.exception;

/**
 * 保存异常
 *
 * @author pengsenhao
 */
public class InsertException extends RuntimeException {

    private static final long serialVersionUID = -3937788835135997513L;

    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