diff --git a/itc-pcitc-dependencies/itc-pcitc-dependencies-api/src/main/java/com/pictc/enums/ExceptionCommonCode.java b/itc-pcitc-dependencies/itc-pcitc-dependencies-api/src/main/java/com/pictc/enums/ExceptionCommonCode.java index 23f152d..746ecab 100644 --- a/itc-pcitc-dependencies/itc-pcitc-dependencies-api/src/main/java/com/pictc/enums/ExceptionCommonCode.java +++ b/itc-pcitc-dependencies/itc-pcitc-dependencies-api/src/main/java/com/pictc/enums/ExceptionCommonCode.java @@ -21,4 +21,15 @@ public interface ExceptionCommonCode { * 执行数据库函数失败 */ final BusinessCode DB_FUNCTION_EXEC_ERROR = BusinessCode.of(10511,"执行数据库函数失败:【{}】"); + + /** + * 执行数据库函数失败 + */ + final BusinessCode DB_FUNCTION_SAVE_EXEC_ERROR = BusinessCode.of(10512,"保存函数失败:【{}】"); + + final BusinessCode DB_FUNCTION_DELETE_EXEC_ERROR = BusinessCode.of(10513,"删除函数失败:【{}】"); + + final BusinessCode DB_FUNCTION_ENABLE_EXEC_ERROR = BusinessCode.of(10514,"启用函数失败:【{}】"); + + final BusinessCode DB_FUNCTION_DISABLE_EXEC_ERROR = BusinessCode.of(10515,"作废函数失败:【{}】"); } diff --git a/itc-pcitc-dependencies/itc-pcitc-dependencies-service/src/main/java/com/xjrsoft/module/common/db/utils/CommonCallUtils.java b/itc-pcitc-dependencies/itc-pcitc-dependencies-service/src/main/java/com/xjrsoft/module/common/db/utils/CommonCallUtils.java index 82585e5..ce62faa 100644 --- a/itc-pcitc-dependencies/itc-pcitc-dependencies-service/src/main/java/com/xjrsoft/module/common/db/utils/CommonCallUtils.java +++ b/itc-pcitc-dependencies/itc-pcitc-dependencies-service/src/main/java/com/xjrsoft/module/common/db/utils/CommonCallUtils.java @@ -3,6 +3,10 @@ package com.xjrsoft.module.common.db.utils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.pictc.enums.BusinessCode; +import com.pictc.enums.ExceptionCommonCode; +import com.pictc.utils.StringUtils; +import com.xjrsoft.common.exception.BusinessException; import com.xjrsoft.module.common.db.service.CommonCallService; /** @@ -31,7 +35,11 @@ public class CommonCallUtils { * @return String 返回类型 函数返回非空、或者数据库异常时rollback,函数返回空时commit; */ public static String saveAfter(String table,long id) { - return callService.saveAfter(table, id); + String error = callService.saveAfter(table, id); + if(StringUtils.isNotEmpty(error)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_SAVE_EXEC_ERROR,error)); + } + return error; } /** @@ -43,7 +51,11 @@ public class CommonCallUtils { * @return String 返回类型 */ public static String deleteBefore(String table,Long id) { - return callService.deleteBefore(table, id); + String error = callService.deleteBefore(table, id); + if(StringUtils.isNotEmpty(error)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR,error)); + } + return error; } @@ -56,7 +68,11 @@ public class CommonCallUtils { * @return String 返回类型 */ public static String disableBefore(String table,Long id) { - return callService.disableBefore(table, id); + String error = callService.disableBefore(table, id); + if(StringUtils.isNotEmpty(error)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DISABLE_EXEC_ERROR,error)); + } + return error; } @@ -68,7 +84,11 @@ public class CommonCallUtils { * @return String 返回类型 */ public static String enableBefore(String table,Long id) { - return callService.enableBefore(table, id); + String error = callService.enableBefore(table, id); + if(StringUtils.isNotEmpty(error)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_ENABLE_EXEC_ERROR,error)); + } + return error; } diff --git a/pom.xml b/pom.xml index 305c568..bb817c8 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ - 2.0.8 + 2.0.4 UTF-8 UTF-8 8 @@ -43,7 +43,7 @@ com.geg itc-framework-ms - 2.0.8 + ${revision} pom import