|
@@ -0,0 +1,79 @@
|
|
|
|
+package cn.iocoder.yudao.module.infra.controller.admin.db.vo;
|
|
|
|
+
|
|
|
|
+public enum ResultCode {
|
|
|
|
+ /* 成功 */
|
|
|
|
+ SUCCESS(200, "成功"),
|
|
|
|
+
|
|
|
|
+ /* 默认失败 */
|
|
|
|
+ ERROR(4000, "失败"),
|
|
|
|
+ ERROR_FILE_NO(4001, "文件未找到"),
|
|
|
|
+ ERROR_FILE_TYPE(4002, "文件类型不正确"),
|
|
|
|
+ ERROR_FILE_DATA(4003, "数据为空"),
|
|
|
|
+ ERROR_DATA_TYPE(4004, "数据格式不正确"),
|
|
|
|
+ ERROR_CONNECT(4005, "数据库连接异常"),
|
|
|
|
+ ERROR_DATA(4006, "数据库操作失败"),
|
|
|
|
+ ERROR_DATA_REPEAT(4007, "数据已存在"),
|
|
|
|
+ ERROR_MODEL(4008, "同场站不同机型至少启用一个模型"),
|
|
|
|
+ ERROR_SQL(4009, "sql语法不正确"),
|
|
|
|
+ ERROR_UNSUPPORTED_SQL(4010, "不支持的sql语句"),
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* 参数错误:1000~1999 */
|
|
|
|
+ PARAM_NOT_VALID(1001, "参数无效"),
|
|
|
|
+ PARAM_IS_BLANK(1002, "参数为空"),
|
|
|
|
+ PARAM_TYPE_ERROR(1003, "参数类型错误"),
|
|
|
|
+ PARAM_NOT_COMPLETE(1004, "参数缺失"),
|
|
|
|
+ ERROR_DATA_DIR(1005, "目录创建失败"),
|
|
|
|
+ ERROR_DATA_FILE(1006, "文件上传失败"),
|
|
|
|
+
|
|
|
|
+ /* 用户错误 */
|
|
|
|
+ USER_NOT_LOGIN(2001, "用户未登录"),
|
|
|
|
+ USER_ACCOUNT_ERROR(2002, "账号或密码错误"),
|
|
|
|
+ USER_FAIL_LOGIN(2003, "登录失败"),
|
|
|
|
+ USER_OUT_LOGIN(2004, "登出成功"),
|
|
|
|
+ USER_ERROR_TOKEN(2005, "登录已过期,请重新登录"),
|
|
|
|
+
|
|
|
|
+ /* 业务错误 */
|
|
|
|
+ NO_PERMISSION(3001, "没有权限"),
|
|
|
|
+ ERROR_ENABLE(3002, "模型为启用状态,不允许删除"),
|
|
|
|
+ ERROR_TASK(3003, "有正在进行的任务,请稍后在试");
|
|
|
|
+
|
|
|
|
+ private Integer code;
|
|
|
|
+ private String message;
|
|
|
|
+
|
|
|
|
+ ResultCode(Integer code, String message) {
|
|
|
|
+ this.code = code;
|
|
|
|
+ this.message = message;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Integer getCode() {
|
|
|
|
+ return code;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCode(Integer code) {
|
|
|
|
+ this.code = code;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getMessage() {
|
|
|
|
+ return message;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setMessage(String message) {
|
|
|
|
+ this.message = message;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据code获取message
|
|
|
|
+ *
|
|
|
|
+ * @param code
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static String getMessageByCode(Integer code) {
|
|
|
|
+ for (ResultCode ele : values()) {
|
|
|
|
+ if (ele.getCode().equals(code)) {
|
|
|
|
+ return ele.getMessage();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+}
|