wangliang 4 년 전
부모
커밋
758c15d67c
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      themis-admin/src/main/java/com/qmth/themis/admin/api/TBUserController.java

+ 7 - 2
themis-admin/src/main/java/com/qmth/themis/admin/api/TBUserController.java

@@ -677,8 +677,13 @@ public class TBUserController {
                 String errorColumn = e.getCause().toString();
                 String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
                         .replaceAll("'", "");
-                throw new BusinessException(
-                        "机构id[" + orgId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
+                if (Objects.nonNull(columnStr) && columnStr.contains("#23000")) {
+                    throw new BusinessException(
+                            "机构id[" + orgId + "]下的" + FieldUniqueEnum.org_login_name.getCode() + "数据不允许重复插入");
+                } else {
+                    throw new BusinessException(
+                            "机构id[" + orgId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
+                }
             } else if (e instanceof BusinessException) {
                 throw new BusinessException(e.getMessage());
             } else {