diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java index 615007191..a499afa96 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java @@ -1,6 +1,6 @@ package cn.iocoder.common.framework.exception; -import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum; +import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.common.framework.vo.CommonResult; /** @@ -11,18 +11,34 @@ public class GlobalException extends RuntimeException { /** * 全局错误码 * - * @see GlobalErrorCodeEnum + * @see GlobalErrorCodeConstants */ - private final Integer code; + private Integer code; + /** + * 错误提示 + */ + private String message; /** * 错误明细,内部调试错误 - * * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + * + * 和 {@link CommonResult#getDetailMessage()} 一致的设计 */ private String detailMessage; + /** + * 空构造方法,避免反序列化问题 + */ + public GlobalException() { + } + + public GlobalException(ErrorCode errorCode) { + this.code = errorCode.getCode(); + this.message = errorCode.getMessage(); + } + public GlobalException(Integer code, String message) { - super(message); this.code = code; + this.message = message; } public Integer getCode() { @@ -38,4 +54,18 @@ public class GlobalException extends RuntimeException { return this; } + public GlobalException setCode(Integer code) { + this.code = code; + return this; + } + + public String getMessage() { + return message; + } + + public GlobalException setMessage(String message) { + this.message = message; + return this; + } + } diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java index e2a72a93c..c9af66cd7 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java @@ -5,30 +5,6 @@ import cn.iocoder.common.framework.vo.CommonResult; /** * 业务逻辑异常 Exception - * - * 参考 https://www.kancloud.cn/onebase/ob/484204 文章 - * - * 一共 10 位,分成四段 - * - * 第一段,1 位,类型 - * 1 - 业务级别异常 - * 2 - 系统级别异常 - * 第二段,3 位,系统类型 - * 001 - 用户系统 - * 002 - 商品系统 - * 003 - 订单系统 - * 004 - 支付系统 - * 005 - 优惠劵系统 - * ... - ... - * 第三段,3 位,模块 - * 不限制规则。 - * 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子: - * 001 - OAuth2 模块 - * 002 - User 模块 - * 003 - MobileCode 模块 - * 第四段,3 位,错误码 - * 不限制规则。 - * 一般建议,每个模块自增。 */ public final class ServiceException extends RuntimeException { @@ -37,7 +13,11 @@ public final class ServiceException extends RuntimeException { * * @see ServiceErrorCodeRange */ - private final Integer code; + private Integer code; + /** + * 错误提示 + */ + private String message; /** * 错误明细,内部调试错误 * @@ -45,9 +25,20 @@ public final class ServiceException extends RuntimeException { */ private String detailMessage; + /** + * 空构造方法,避免反序列化问题 + */ + public ServiceException() { + } + + public ServiceException(ErrorCode errorCode) { + this.code = errorCode.getCode(); + this.message = errorCode.getMessage(); + } + public ServiceException(Integer code, String message) { - super(message); this.code = code; + this.message = message; } public Integer getCode() { @@ -63,4 +54,18 @@ public final class ServiceException extends RuntimeException { return this; } + public ServiceException setCode(Integer code) { + this.code = code; + return this; + } + + public String getMessage() { + return message; + } + + public ServiceException setMessage(String message) { + this.message = message; + return this; + } + } diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeConstants.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeConstants.java new file mode 100644 index 000000000..da4df581c --- /dev/null +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeConstants.java @@ -0,0 +1,37 @@ +package cn.iocoder.common.framework.exception.enums; + +import cn.iocoder.common.framework.exception.ErrorCode; + +/** + * 全局错误码枚举 + * 0-999 系统异常编码保留 + * + * 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status + * 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的 + * 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。 + */ +public interface GlobalErrorCodeConstants { + + ErrorCode SUCCESS = new ErrorCode(0, "成功"); + + // ========== 客户端错误段 ========== + + ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确"); + ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录"); + ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限"); + ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到"); + ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确"); + + // ========== 服务端错误段 ========== + + ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常"); + + ErrorCode UNKNOWN = new ErrorCode(999, "未知错误"); + + + static boolean isMatch(Integer code) { + return code != null + && code >= SUCCESS.getCode() && code <= UNKNOWN.getCode(); + } + +} diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeEnum.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeEnum.java deleted file mode 100644 index 9774c31a8..000000000 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeEnum.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.iocoder.common.framework.exception.enums; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; - -/** - * 全局错误码枚举 - * 0-999 系统异常编码保留 - * - * 一般情况下,{@link GlobalErrorCodeEnum#getCode()} ()} 使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status - * 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的 - * 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。 - */ -public enum GlobalErrorCodeEnum implements ServiceExceptionUtil.Enumerable { - - SUCCESS(0, "成功"), - - // ========== 客户端错误段 ========== - - BAD_REQUEST(400, "请求参数不正确"), - UNAUTHORIZED(401, "账号未登录"), - FORBIDDEN(403, "没有该操作权限"), - NOT_FOUND(404, "请求未找到"), - METHOD_NOT_ALLOWED(405, "请求方法不正确"), - - // ========== 服务端错误段 ========== - - INTERNAL_SERVER_ERROR(500, "系统异常"), - ; - - private final int code; - private final String message; - - GlobalErrorCodeEnum(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } - - @Override - public int getGroup() { - return 0; - } - -} diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/ServiceExceptionUtil.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/ServiceExceptionUtil.java index e9df095ef..ea4adfe4e 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/ServiceExceptionUtil.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/ServiceExceptionUtil.java @@ -1,10 +1,9 @@ package cn.iocoder.common.framework.util; +import cn.iocoder.common.framework.exception.ErrorCode; import cn.iocoder.common.framework.exception.ServiceException; -import cn.iocoder.common.framework.vo.CommonResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.util.Assert; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -27,19 +26,6 @@ public class ServiceExceptionUtil { private static final Logger LOGGER = LoggerFactory.getLogger(ServiceExceptionUtil.class); - /** - * 错误枚举的接口 - */ - public interface Enumerable { - - int getCode(); - - String getMessage(); - - int getGroup(); - - } - /** * 错误码提示模板 */ @@ -57,35 +43,16 @@ public class ServiceExceptionUtil { ServiceExceptionUtil.messages.remove(code, message); } - // ========== 和 CommonResult 的集成 ========== - - public static CommonResult error(Enumerable enumerable) { - return error(enumerable.getCode()); - } - - public static CommonResult error(Enumerable enumerable, Object... params) { - return error(enumerable.getCode(), params); - } - - public static CommonResult error(Integer code) { - return CommonResult.error(code, messages.get(code)); - } - - public static CommonResult error(Integer code, Object... params) { - String message = doFormat(code, messages.get(code), params); - return CommonResult.error(code, message); - } - // ========== 和 ServiceException 的集成 ========== - public static ServiceException exception(Enumerable enumerable) { - String messagePattern = messages.getOrDefault(enumerable.getCode(), enumerable.getMessage()); - return exception0(enumerable.getCode(), messagePattern); + public static ServiceException exception(ErrorCode errorCode) { + String messagePattern = messages.getOrDefault(errorCode.getCode(), errorCode.getMessage()); + return exception0(errorCode.getCode(), messagePattern); } - public static ServiceException exception(Enumerable enumerable, Object... params) { - String messagePattern = messages.getOrDefault(enumerable.getCode(), enumerable.getMessage()); - return exception0(enumerable.getCode(), messagePattern, params); + public static ServiceException exception(ErrorCode errorCode, Object... params) { + String messagePattern = messages.getOrDefault(errorCode.getCode(), errorCode.getMessage()); + return exception0(errorCode.getCode(), messagePattern, params); } /** @@ -114,10 +81,7 @@ public class ServiceExceptionUtil { return new ServiceException(code, message); } - public static ServiceException exception(CommonResult result) { - Assert.isTrue(result.isError(), "结果必须是错误的"); - return new ServiceException(result.getCode(), result.getMessage()); - } + // ========== 格式化方法 ========== /** * 将错误编号对应的消息使用 params 进行格式化。 diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java index c6972ffe9..7b77f42db 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java @@ -1,8 +1,9 @@ package cn.iocoder.common.framework.vo; import cn.iocoder.common.framework.exception.ErrorCode; -import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum; -import cn.iocoder.common.framework.util.ServiceExceptionUtil; +import cn.iocoder.common.framework.exception.GlobalException; +import cn.iocoder.common.framework.exception.ServiceException; +import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants; import com.alibaba.fastjson.annotation.JSONField; import org.springframework.util.Assert; @@ -15,8 +16,6 @@ import java.io.Serializable; */ public final class CommonResult implements Serializable { - private static final Integer CODE_SUCCESS = GlobalErrorCodeEnum.SUCCESS.getCode(); - /** * 错误码 * @@ -30,7 +29,7 @@ public final class CommonResult implements Serializable { /** * 错误提示,用户可阅读 * - * @see ErrorCode#getMsg() + * @see ErrorCode#getMessage() () */ private String message; /** @@ -48,20 +47,25 @@ public final class CommonResult implements Serializable { * @return 新的 CommonResult 对象 */ public static CommonResult error(CommonResult result) { - return error(result.getCode(), result.getMessage()); + return error(result.getCode(), result.getMessage(), result.detailMessage); } public static CommonResult error(Integer code, String message) { - Assert.isTrue(!CODE_SUCCESS.equals(code), "code 必须是错误的!"); + return error(code, message, null); + } + + public static CommonResult error(Integer code, String message, String detailMessage) { + Assert.isTrue(!GlobalErrorCodeConstants.SUCCESS.getCode().equals(code), "code 必须是错误的!"); CommonResult result = new CommonResult<>(); result.code = code; result.message = message; + result.detailMessage = detailMessage; return result; } public static CommonResult success(T data) { CommonResult result = new CommonResult<>(); - result.code = CODE_SUCCESS; + result.code = GlobalErrorCodeConstants.SUCCESS.getCode(); result.data = data; result.message = ""; return result; @@ -102,7 +106,7 @@ public final class CommonResult implements Serializable { @JSONField(serialize = false) // 避免序列化 public boolean isSuccess() { - return CODE_SUCCESS.equals(code); + return GlobalErrorCodeConstants.SUCCESS.getCode().equals(code); } @JSONField(serialize = false) // 避免序列化 @@ -110,23 +114,31 @@ public final class CommonResult implements Serializable { return !isSuccess(); } - /** - * 判断是否有异常。如果有,则抛出 {@link cn.iocoder.common.framework.exception.ServiceException} 异常 - */ - public void checkError() { - if (isSuccess()) { - return; - } - throw ServiceExceptionUtil.exception0(code, message); - } - @Override public String toString() { return "CommonResult{" + "code=" + code + - ", message='" + message + '\'' + ", data=" + data + + ", message='" + message + '\'' + + ", detailMessage='" + detailMessage + '\'' + '}'; } + // ========= 和 Exception 异常体系集成 ========= + + /** + * 判断是否有异常。如果有,则抛出 {@link GlobalException} 或 {@link ServiceException} 异常 + */ + public void checkError() throws GlobalException, ServiceException { + if (isSuccess()) { + return; + } + // 全局异常 + if (GlobalErrorCodeConstants.isMatch(code)) { + throw new GlobalException(code, message).setDetailMessage(detailMessage); + } + // 业务异常 + throw new ServiceException(code, message).setDetailMessage(detailMessage); + } + } diff --git a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/dataobject/BaseDO.java b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/dataobject/BaseDO.java similarity index 94% rename from common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/dataobject/BaseDO.java rename to common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/dataobject/BaseDO.java index de1c7ec16..fb35f6362 100644 --- a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/dataobject/BaseDO.java +++ b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/dataobject/BaseDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.mybatis.dataobject; +package cn.iocoder.mall.mybatis.core.dataobject; import java.io.Serializable; import java.util.Date; diff --git a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/dataobject/DeletableDO.java b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/dataobject/DeletableDO.java similarity index 92% rename from common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/dataobject/DeletableDO.java rename to common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/dataobject/DeletableDO.java index 1584c0fe0..457a1ec2d 100644 --- a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/dataobject/DeletableDO.java +++ b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/dataobject/DeletableDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.mybatis.dataobject; +package cn.iocoder.mall.mybatis.core.dataobject; import com.baomidou.mybatisplus.annotation.TableLogic; diff --git a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/enums/DeletedStatusEnum.java b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/enums/DeletedStatusEnum.java similarity index 84% rename from common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/enums/DeletedStatusEnum.java rename to common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/enums/DeletedStatusEnum.java index f5d0301c4..60dd33625 100644 --- a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/enums/DeletedStatusEnum.java +++ b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/enums/DeletedStatusEnum.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.mybatis.enums; +package cn.iocoder.mall.mybatis.core.enums; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; /** * {@link DeletableDO#getDeleted()} delete 状态 diff --git a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/query/QueryWrapperX.java b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/query/QueryWrapperX.java similarity index 97% rename from common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/query/QueryWrapperX.java rename to common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/query/QueryWrapperX.java index 247cd43fd..e38336966 100644 --- a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/query/QueryWrapperX.java +++ b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/query/QueryWrapperX.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.mybatis.query; +package cn.iocoder.mall.mybatis.core.query; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; diff --git a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/type/JSONTypeHandler.java b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/type/JSONTypeHandler.java similarity index 97% rename from common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/type/JSONTypeHandler.java rename to common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/type/JSONTypeHandler.java index 7a8907fd7..38334e556 100644 --- a/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/type/JSONTypeHandler.java +++ b/common/mall-spring-boot-starter-mybatis/src/main/java/cn/iocoder/mall/mybatis/core/type/JSONTypeHandler.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.mybatis.type; +package cn.iocoder.mall.mybatis.core.type; import com.alibaba.fastjson.JSON; import org.apache.ibatis.type.BaseTypeHandler; diff --git a/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java b/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java index 741fc6444..9f72b5a68 100644 --- a/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java +++ b/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.security.admin.core.interceptor; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum; +import cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants; import org.springframework.http.HttpMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; @@ -22,7 +22,7 @@ public class AdminDemoInterceptor extends HandlerInterceptorAdapter { // 当 Admin 编号等于 0 时,约定为演示账号 if (Objects.equals(AdminSecurityContextHolder.getAdminId(), 0) && request.getMethod().equalsIgnoreCase(HttpMethod.POST.toString())) { - throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.PERMISSION_DEMO_PERMISSION_DENY); + throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.PERMISSION_DEMO_PERMISSION_DENY); } return true; } diff --git a/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java b/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java index 617ceb76a..645e89e49 100644 --- a/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java +++ b/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.security.admin.core.interceptor; -import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum; import cn.iocoder.common.framework.enums.UserTypeEnum; +import cn.iocoder.common.framework.exception.GlobalException; import cn.iocoder.common.framework.util.CollectionUtils; import cn.iocoder.common.framework.util.HttpUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil; @@ -23,7 +23,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.OAUTH_USER_TYPE_ERROR; +import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.OAUTH_USER_TYPE_ERROR; public class AdminSecurityInterceptor extends HandlerInterceptorAdapter { @@ -68,7 +69,7 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter { private void checkAuthentication(HandlerMethod handlerMethod, Integer adminId) { boolean requiresAuthenticate = !handlerMethod.hasMethodAnnotation(RequiresNone.class); // 对于 ADMIN 来说,默认需登录 if (requiresAuthenticate && adminId == null) { - throw ServiceExceptionUtil.exception(GlobalErrorCodeEnum.UNAUTHORIZED); + throw new GlobalException(UNAUTHORIZED); } } diff --git a/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java b/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java index a3b1f4af9..5085a27ef 100644 --- a/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java +++ b/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java @@ -19,7 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.OAUTH_USER_TYPE_ERROR; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.OAUTH_USER_TYPE_ERROR; public class UserSecurityInterceptor extends HandlerInterceptorAdapter { diff --git a/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java b/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java index eec4f6579..1a8498f4c 100644 --- a/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java +++ b/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.web.core.handler; -import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum; import cn.iocoder.common.framework.exception.ServiceException; +import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.common.framework.util.ExceptionUtil; import cn.iocoder.common.framework.util.HttpUtil; import cn.iocoder.common.framework.util.MallUtils; @@ -32,6 +32,8 @@ import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import java.util.Date; +import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.*; + /** * 全局异常处理器,将 Exception 翻译成 CommonResult + 对应的异常编号 */ @@ -62,7 +64,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(value = MissingServletRequestParameterException.class) public CommonResult missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException ex) { logger.warn("[missingServletRequestParameterExceptionHandler]", ex); - return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(), + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数缺失:%s", ex.getParameterName())); } @@ -74,7 +76,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(MethodArgumentTypeMismatchException.class) public CommonResult methodArgumentTypeMismatchExceptionHandler(MethodArgumentTypeMismatchException ex) { logger.warn("[missingServletRequestParameterExceptionHandler]", ex); - return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(), + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", ex.getMessage())); } @@ -86,7 +88,7 @@ public class GlobalExceptionHandler { logger.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex); FieldError fieldError = ex.getBindingResult().getFieldError(); assert fieldError != null; // 断言,避免告警 - return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(), + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); } @@ -98,7 +100,7 @@ public class GlobalExceptionHandler { logger.warn("[handleBindException]", ex); FieldError fieldError = ex.getFieldError(); assert fieldError != null; // 断言,避免告警 - return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(), + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); } @@ -109,7 +111,7 @@ public class GlobalExceptionHandler { public CommonResult constraintViolationExceptionHandler(ConstraintViolationException ex) { logger.warn("[constraintViolationExceptionHandler]", ex); ConstraintViolation constraintViolation = ex.getConstraintViolations().iterator().next(); - return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(), + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", constraintViolation.getMessage())); } @@ -123,7 +125,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(NoHandlerFoundException.class) public CommonResult noHandlerFoundExceptionHandler(NoHandlerFoundException ex) { logger.warn("[noHandlerFoundExceptionHandler]", ex); - return CommonResult.error(GlobalErrorCodeEnum.NOT_FOUND.getCode(), + return CommonResult.error(GlobalErrorCodeConstants.NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())); } @@ -135,7 +137,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(HttpRequestMethodNotSupportedException.class) public CommonResult httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException ex) { logger.warn("[httpRequestMethodNotSupportedExceptionHandler]", ex); - return CommonResult.error(GlobalErrorCodeEnum.METHOD_NOT_ALLOWED.getCode(), + return CommonResult.error(GlobalErrorCodeConstants.METHOD_NOT_ALLOWED.getCode(), String.format("请求方法不正确:%s", ex.getMessage())); } @@ -169,7 +171,7 @@ public class GlobalExceptionHandler { logger.error("[defaultExceptionHandler][插入访问日志({}) 发生异常({})", JSON.toJSONString(exceptionLog), ExceptionUtils.getRootCauseMessage(th)); } // 返回 ERROR CommonResult - return CommonResult.error(GlobalErrorCodeEnum.INTERNAL_SERVER_ERROR.getCode(), GlobalErrorCodeEnum.INTERNAL_SERVER_ERROR.getMessage()); + return CommonResult.error(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(), GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getMessage()); } private void initExceptionLog(SystemExceptionLogCreateDTO exceptionLog, HttpServletRequest request, Throwable e) { diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsBO.java index 59cb841aa..f9f06307a 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsBO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsBO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.bo; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java index f18bf20d4..c1491d0e1 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderRecipientBO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.bo; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java index dc5b91397..96e92684c 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.bo.order; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java index 883e6aa30..e7a255455 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.bo.order; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java index c92a6db1a..a7d679124 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import java.util.Date; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java index 26afd1b98..d930b2168 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java index 713e2550a..c0edadf19 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java index 3632794bd..d56f1eb50 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import java.util.Date; import lombok.Data; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java index 971ac0283..828206ba8 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import java.util.Date; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java index 2196ea9c2..afb2365ca 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import java.util.Date; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java index fb402f3ae..16873a6c1 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java index 0e67c0596..e4440a917 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import java.util.Date; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java index 537c05773..989b51f64 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java index b9e9c93bf..8559172b4 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import java.util.Date; import lombok.Data; import lombok.experimental.Accessors; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java index c551b0b83..d1cf55a7d 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.biz.dataobject.comment; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; diff --git a/pay/pay-service-impl/src/main/resources/mapper/PayNotifyTaskMapper.xml b/pay/pay-service-impl/src/main/resources/mapper/PayNotifyTaskMapper.xml index e359d1f07..74651ac19 100644 --- a/pay/pay-service-impl/src/main/resources/mapper/PayNotifyTaskMapper.xml +++ b/pay/pay-service-impl/src/main/resources/mapper/PayNotifyTaskMapper.xml @@ -11,10 +11,10 @@ + typeHandler="cn.iocoder.mall.mybatis.core.type.JSONTypeHandler"/> + typeHandler="cn.iocoder.mall.mybatis.core.type.JSONTypeHandler"/> diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java index 4ce7f0ec0..c9e8469b6 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.biz.dataobject.attr; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrValueDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrValueDO.java index dcb78ab92..15e75e36a 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrValueDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/attr/ProductAttrValueDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.biz.dataobject.attr; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java index d2ccd6508..01b47a3a2 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/brand/ProductBrandDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.biz.dataobject.brand; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java index 6eff17238..317684f5a 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/category/ProductCategoryDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.biz.dataobject.category; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java index c457b59ae..bf800bb52 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.biz.dataobject.spu; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrDO; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java index 3bbcdfe46..d75731c04 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.biz.dataobject.spu; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/attr/ProductAttrServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/attr/ProductAttrServiceImpl.java index 4551e9f2f..ec75c8f69 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/attr/ProductAttrServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/attr/ProductAttrServiceImpl.java @@ -3,7 +3,7 @@ package cn.iocoder.mall.product.biz.service.attr; import cn.iocoder.common.framework.util.CollectionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO; import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java index 6cecf2b16..b70a7b5ff 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/brand/ProductBrandServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.product.biz.service.brand; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO; import cn.iocoder.mall.product.biz.convert.brand.ProductBrandConvert; import cn.iocoder.mall.product.biz.dao.brand.ProductBrandMapper; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java index 2a43d3abc..16a0231f6 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/category/ProductCategoryServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.biz.service.category; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO; import cn.iocoder.mall.product.biz.convert.category.ProductCategoryConvert; import cn.iocoder.mall.product.biz.dao.category.ProductCategoryMapper; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java index 5f3a6f601..006aff641 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/spu/ProductSpuServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.product.biz.service.spu; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.StringUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.biz.bo.product.ProductAttrAndValuePairBO; import cn.iocoder.mall.product.biz.bo.product.ProductSpuDetailBO; import cn.iocoder.mall.product.biz.convert.sku.ProductSpuConvert; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java index 02b465ce0..360fc9df8 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java index 23ff2ef2c..5d9aba81b 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java index d3b04bd20..8dc593d82 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductBrandDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java index 0d1af5ac7..c02eee672 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java index 4d41f73ce..85ac8d80e 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java index 08b6b918a..18aa70805 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.product.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/message/UserProductSpuCollectionsConsumer.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/message/UserProductSpuCollectionsConsumer.java index 8677bd0a6..6ac61c80d 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/message/UserProductSpuCollectionsConsumer.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/message/UserProductSpuCollectionsConsumer.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.message; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.api.UserProductSpuCollectionsService; import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO; import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsAddDTO; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java index c7691d790..504b783a6 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductAttrServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.service; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.api.ProductAttrService; import cn.iocoder.mall.product.api.bo.*; import cn.iocoder.mall.product.api.constant.ProductAttrConstants; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java index 35d658621..1818194ef 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.service; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.api.ProductCategoryService; import cn.iocoder.mall.product.api.bo.ProductCategoryBO; import cn.iocoder.mall.product.api.constant.ProductCategoryConstants; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java index 6a572ee48..72e251b74 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java @@ -3,7 +3,7 @@ package cn.iocoder.mall.product.service; import cn.iocoder.common.framework.util.CollectionUtil; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.StringUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.api.ProductSpuService; import cn.iocoder.mall.product.api.bo.*; import cn.iocoder.mall.product.api.constant.ProductCategoryConstants; diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/UserProductSpuCollectionsServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/UserProductSpuCollectionsServiceImpl.java index 067031394..6198103cb 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/UserProductSpuCollectionsServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/UserProductSpuCollectionsServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.product.service; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.api.UserProductSpuCollectionsService; import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO; import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsPageBO; diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java index 7d3ce53a9..a51893842 100644 --- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java +++ b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java index 81f58d114..11a4f1546 100644 --- a/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java +++ b/promotion/promotion-biz/src/main/java/cn/iocoder/mall/promotion/biz/service/banner/BannerServiceImpl.java @@ -3,7 +3,7 @@ package cn.iocoder.mall.promotion.biz.service.banner; import cn.iocoder.common.framework.enums.CommonStatusEnum; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.promotion.biz.api.enums.PromotionErrorCodeEnum; import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO; import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java index 7d3ce53a9..a51893842 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java index e4803d5f3..b28d9f305 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java index d090227ab..76693d3e0 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java index 6d3a20406..4a2489a49 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java index 094f3116b..7132427e7 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java index d729a0ee0..e8075556a 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java index f36c8ba77..e0a7cd47b 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.mybatis; -import cn.iocoder.mall.mybatis.type.JSONTypeHandler; +import cn.iocoder.mall.mybatis.core.type.JSONTypeHandler; import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO; public class TestHandler extends JSONTypeHandler { diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java index 283a7b565..280c1b4fd 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.promotion.biz.service; import cn.iocoder.common.framework.enums.CommonStatusEnum; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.promotion.api.BannerService; import cn.iocoder.mall.promotion.api.bo.BannerBO; import cn.iocoder.mall.promotion.api.bo.BannerPageBO; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java index 9d441de00..a32ad6e1b 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.promotion.biz.service; import cn.iocoder.common.framework.enums.CommonStatusEnum; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.product.rpc.api.ProductSpuRpc; import cn.iocoder.mall.promotion.api.ProductRecommendService; import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO; diff --git a/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml b/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml index 82b093cdb..4aa07e337 100644 --- a/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml +++ b/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml @@ -9,8 +9,8 @@ - - + + diff --git a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/enums/SystemErrorCodeConstants.java b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/enums/SystemErrorCodeConstants.java new file mode 100644 index 000000000..5f67f80f8 --- /dev/null +++ b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/enums/SystemErrorCodeConstants.java @@ -0,0 +1,84 @@ +package cn.iocoder.mall.systemservice.enums; + +import cn.iocoder.common.framework.exception.ErrorCode; + +/** + * 错误码枚举类 + * + * system 系统,使用 1-002-000-000 段 + */ +public interface SystemErrorCodeConstants { + + // ========== OAUTH2 模块 ========== + ErrorCode OAUTH2_UNKNOWN = new ErrorCode(1001001000, "未知错误"); // 预留 + // 预留 1001001001 ~ 1001001099 错误码,方便前端 + ErrorCode OAUTH2_ACCESS_TOKEN_NOT_FOUND = new ErrorCode(1001001001, "访问令牌不存在"); + ErrorCode OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED = new ErrorCode(1001001002, "访问令牌已过期"); + ErrorCode OAUTH2_ACCESS_TOKEN_INVALID = new ErrorCode(1001001003, "访问令牌已失效"); + ErrorCode OAUTH2_REFRESH_TOKEN_NOT_FOUND = new ErrorCode(1001001005, "刷新令牌不存在"); + ErrorCode OAUTH_REFRESH_TOKEN_EXPIRED = new ErrorCode(1001001006, "访问令牌已过期"); + ErrorCode OAUTH_REFRESH_TOKEN_INVALID = new ErrorCode(1001001007, "刷新令牌已失效"); + // 其它 1001001100 开始 + ErrorCode OAUTH_USER_TYPE_ERROR = new ErrorCode(1001001101, "用户类型并不正确"); + + // ========== 管理员模块 1002002000 ========== + ErrorCode ADMIN_NOT_FOUND = new ErrorCode(1002002000, "管理员不存在"); + ErrorCode ADMIN_PASSWORD_ERROR = new ErrorCode(1002002001, "密码不正确"); + ErrorCode ADMIN_IS_DISABLE = new ErrorCode(1002002002, "账号被禁用"); + ErrorCode ADMIN_USERNAME_EXISTS = new ErrorCode(1002002002, "账号已经存在"); + ErrorCode ADMIN_STATUS_EQUALS = new ErrorCode(1002002003, "账号已经是该状态"); +// ErrorCode ADMIN_DELETE_ONLY_DISABLE = new ErrorCode(1002002004, "只有关闭的账号才可以删除"); + ErrorCode ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE = new ErrorCode(1002002005, "管理员的账号状态不允许变更"); + ErrorCode ADMIN_ASSIGN_ROLE_NOT_EXISTS = new ErrorCode(1002002006, "分配员工角色时,有角色不存在"); + ErrorCode ADMIN_ADMIN_CAN_NOT_UPDATE = new ErrorCode(1002002008, "管理员的账号不允许变更"); + ErrorCode ADMIN_USERNAME_NOT_EXISTS = new ErrorCode(1002002008, "账号不存在"); + + // ========== 资源模块 1002003000 ========== + ErrorCode RESOURCE_NAME_DUPLICATE = new ErrorCode(1002003000, "已经存在该名字的资源"); + ErrorCode RESOURCE_PARENT_NOT_EXISTS = new ErrorCode(1002003001, "父资源不存在"); + ErrorCode RESOURCE_PARENT_ERROR = new ErrorCode(1002003002, "不能设置自己为父资源"); + ErrorCode RESOURCE_NOT_EXISTS = new ErrorCode(1002003003, "资源不存在"); + ErrorCode RESOURCE_EXISTS_CHILDREN = new ErrorCode(1002003004, "存在子资源,无法删除"); + ErrorCode RESOURCE_PARENT_NOT_MENU = new ErrorCode(1002003005, "父资源的类型必须是菜单"); + + // ========== 角色模块 1002004000 ========== + ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1002004000, "角色不存在"); + ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1002004001, "已经存在名为【{}}】的角色"); + ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1002004002, "已经存在编码为【{}}】的角色"); + ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1002004004, "不能修改类型为系统内置的角色"); + ErrorCode ROLE_CAN_NOT_DELETE_SYSTEM_TYPE_ROLE = new ErrorCode(1002004005, "不能删除类型为系统内置的角色"); + + // ========== 数据字典模块 1002005000 ========== + ErrorCode DATA_DICT_EXISTS = new ErrorCode(1002005000, "该数据字典已经存在"); + ErrorCode DATA_DICT_NOT_EXISTS = new ErrorCode(1002005001, "该数据字典不存在"); + + // ========== 短信模板 1002006000 ========== + ErrorCode SMS_PLATFORM_FAIL = new ErrorCode(1002006000, "短信平台调用失败【具体错误会动态替换】"); + ErrorCode SMS_SIGN_NOT_EXISTENT = new ErrorCode(1002006001, "短信签名不存在"); + ErrorCode SMS_SIGN_IS_EXISTENT = new ErrorCode(1002006002, "短信签名已存在"); + ErrorCode SMS_TEMPLATE_NOT_EXISTENT = new ErrorCode(1002006020, "短信签名不存在"); + ErrorCode SMS_TEMPLATE_IS_EXISTENT = new ErrorCode(1002006021, "短信签名不存在"); + ErrorCode SMS_NOT_SEND_CLIENT = new ErrorCode(1002006030, "短信没有发送的client"); + + // ========== 部门模块 1002007000 ========== + ErrorCode DEPARTMENT_NAME_DUPLICATE = new ErrorCode(1002007001, "已经存在该名字的部门"); + ErrorCode DEPARTMENT_PARENT_NOT_EXITS = new ErrorCode(1002007002,"父级部门不存在"); + ErrorCode DEPARTMENT_NOT_FOUND = new ErrorCode(1002007003, "当前部门不存在"); + ErrorCode DEPARTMENT_EXITS_CHILDREN = new ErrorCode(1002007004, "存在子部门,无法删除"); + ErrorCode DEPARTMENT_PARENT_ERROR = new ErrorCode(1002007005, "不能设置自己为父资源"); + ErrorCode DEPARTMENT_EXISTS_ADMIN = new ErrorCode(1002007006, "部门中存在员工,无法删除"); + + // ========== 权限模块 1002008000 ========== + ErrorCode PERMISSION_DEMO_PERMISSION_DENY = new ErrorCode(1002008002, "演示账号,暂不允许写操作。欢迎加入我们的交流群:http://t.cn/EKEr5WE"); + ErrorCode PERMISSION_ROLE_ASSIGN_RESOURCE_NOT_EXISTS = new ErrorCode(1002008004, "分配角色资源时,有资源不存在"); + + // ========== 错误码模块 1002009000 ========== + ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1002009000, "错误码不存在"); + ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1002009001, "已经存在编码为【{}}】的错误码"); + ErrorCode ERROR_CAN_NOT_UPDATE_SYSTEM_TYPE_ERROR = new ErrorCode(1002004003, "不能修改类型为系统内置的错误码"); + + // ========== 系统异常日志模块 1002010000 ========== + ErrorCode SYSTEM_EXCEPTION_LOG_NOT_FOUND = new ErrorCode(1002010000, "系统异常日志不存在"); + ErrorCode SYSTEM_EXCEPTION_LOG_PROCESSED = new ErrorCode(1002010001, "系统异常日志已处理"); + +} diff --git a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/enums/SystemErrorCodeEnum.java b/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/enums/SystemErrorCodeEnum.java deleted file mode 100644 index 58aee6ebb..000000000 --- a/system-service-project/system-service-api/src/main/java/cn/iocoder/mall/systemservice/enums/SystemErrorCodeEnum.java +++ /dev/null @@ -1,112 +0,0 @@ -package cn.iocoder.mall.systemservice.enums; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; - -/** - * 错误码枚举类 - * - * system 系统,使用 1-002-000-000 段 - */ -public enum SystemErrorCodeEnum implements ServiceExceptionUtil.Enumerable { - - // ========== OAUTH2 模块 ========== - OAUTH2_UNKNOWN(1001001000, "未知错误"), // 预留 - // 预留 1001001001 ~ 1001001099 错误码,方便前端 - OAUTH2_ACCESS_TOKEN_NOT_FOUND(1001001001, "访问令牌不存在"), - OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED(1001001002, "访问令牌已过期"), - OAUTH2_ACCESS_TOKEN_INVALID(1001001003, "访问令牌已失效"), - OAUTH2_REFRESH_TOKEN_NOT_FOUND(1001001005, "刷新令牌不存在"), - OAUTH_REFRESH_TOKEN_EXPIRED(1001001006, "访问令牌已过期"), - OAUTH_REFRESH_TOKEN_INVALID(1001001007, "刷新令牌已失效"), - // 其它 1001001100 开始 - OAUTH_USER_TYPE_ERROR(1001001101, "用户类型并不正确"), - - // ========== 管理员模块 1002002000 ========== - ADMIN_NOT_FOUND(1002002000, "管理员不存在"), - ADMIN_PASSWORD_ERROR(1002002001, "密码不正确"), - ADMIN_IS_DISABLE(1002002002, "账号被禁用"), - ADMIN_USERNAME_EXISTS(1002002002, "账号已经存在"), - ADMIN_STATUS_EQUALS(1002002003, "账号已经是该状态"), -// ADMIN_DELETE_ONLY_DISABLE(1002002004, "只有关闭的账号才可以删除"), - ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE(1002002005, "管理员的账号状态不允许变更"), - ADMIN_ASSIGN_ROLE_NOT_EXISTS(1002002006, "分配员工角色时,有角色不存在"), - ADMIN_ADMIN_CAN_NOT_UPDATE(1002002008, "管理员的账号不允许变更"), - ADMIN_USERNAME_NOT_EXISTS(1002002008, "账号不存在"), - - // ========== 资源模块 1002003000 ========== - RESOURCE_NAME_DUPLICATE(1002003000, "已经存在该名字的资源"), - RESOURCE_PARENT_NOT_EXISTS(1002003001, "父资源不存在"), - RESOURCE_PARENT_ERROR(1002003002, "不能设置自己为父资源"), - RESOURCE_NOT_EXISTS(1002003003, "资源不存在"), - RESOURCE_EXISTS_CHILDREN(1002003004, "存在子资源,无法删除"), - RESOURCE_PARENT_NOT_MENU(1002003005, "父资源的类型必须是菜单"), - - // ========== 角色模块 1002004000 ========== - ROLE_NOT_EXISTS(1002004000, "角色不存在"), - ROLE_NAME_DUPLICATE(1002004001, "已经存在名为【{}}】的角色"), - ROLE_CODE_DUPLICATE(1002004002, "已经存在编码为【{}}】的角色"), - ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE(1002004004, "不能修改类型为系统内置的角色"), - ROLE_CAN_NOT_DELETE_SYSTEM_TYPE_ROLE(1002004005, "不能删除类型为系统内置的角色"), - - // ========== 数据字典模块 1002005000 ========== - DATA_DICT_EXISTS(1002005000, "该数据字典已经存在"), - DATA_DICT_NOT_EXISTS(1002005001, "该数据字典不存在"), - - // ========== 短信模板 1002006000 ========== - SMS_PLATFORM_FAIL(1002006000, "短信平台调用失败【具体错误会动态替换】"), - SMS_SIGN_NOT_EXISTENT(1002006001, "短信签名不存在"), - SMS_SIGN_IS_EXISTENT(1002006002, "短信签名已存在"), - SMS_TEMPLATE_NOT_EXISTENT(1002006020, "短信签名不存在"), - SMS_TEMPLATE_IS_EXISTENT(1002006021, "短信签名不存在"), - SMS_NOT_SEND_CLIENT(1002006030, "短信没有发送的client"), - - // ========== 部门模块 1002007000 ========== - DEPARTMENT_NAME_DUPLICATE(1002007001, "已经存在该名字的部门"), - DEPARTMENT_PARENT_NOT_EXITS(1002007002,"父级部门不存在"), - DEPARTMENT_NOT_FOUND(1002007003, "当前部门不存在"), - DEPARTMENT_EXITS_CHILDREN(1002007004, "存在子部门,无法删除"), - DEPARTMENT_PARENT_ERROR(1002007005, "不能设置自己为父资源"), - DEPARTMENT_EXISTS_ADMIN(1002007006, "部门中存在员工,无法删除"), - - // ========== 权限模块 1002008000 ========== - PERMISSION_DEMO_PERMISSION_DENY(1002008002, "演示账号,暂不允许写操作。欢迎加入我们的交流群:http://t.cn/EKEr5WE"), - PERMISSION_ROLE_ASSIGN_RESOURCE_NOT_EXISTS(1002008004, "分配角色资源时,有资源不存在"), - - // ========== 错误码模块 1002009000 ========== - ERROR_CODE_NOT_EXISTS(1002009000, "错误码不存在"), - ERROR_CODE_DUPLICATE(1002009001, "已经存在编码为【{}}】的错误码"), - ERROR_CAN_NOT_UPDATE_SYSTEM_TYPE_ERROR(1002004003, "不能修改类型为系统内置的错误码"), - - // ========== 系统异常日志模块 1002010000 ========== - SYSTEM_EXCEPTION_LOG_NOT_FOUND(1002010000, "系统异常日志不存在"), - SYSTEM_EXCEPTION_LOG_PROCESSED(1002010001, "系统异常日志已处理"), - - ; - - - private final int code; - private final String message; - - SystemErrorCodeEnum(int code, String message) { - this.code = code; - this.message = message; - } - - @Override - public int getCode() { - return code; - } - - @Override - public String getMessage() { - return message; - } - - // TODO: 2020-05-22 封装成start的时候,直接在start中定义一个统一的枚举,从中取值; - @Override - public int getGroup() { - return 0; - } - - -} diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/config/ServiceExceptionConfiguration.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/config/ServiceExceptionConfiguration.java deleted file mode 100644 index 493f2a351..000000000 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/config/ServiceExceptionConfiguration.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.systemservice.config; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.EventListener; - -import java.util.Arrays; - -@Configuration -public class ServiceExceptionConfiguration { - - @EventListener(ApplicationReadyEvent.class) - public void initMessages() { - Arrays.stream(SystemErrorCodeEnum.values()).forEach( - item -> ServiceExceptionUtil.put(item.getCode(), item.getMessage())); - } - -} diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/AdminDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/AdminDO.java index 56b904e4f..187f159c6 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/AdminDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/AdminDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import cn.iocoder.mall.systemservice.enums.admin.AdminStatusEnum; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/DepartmentDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/DepartmentDO.java index 1f3cc14d5..a4e1c8370 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/DepartmentDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/admin/DepartmentDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/datadict/DataDictDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/datadict/DataDictDO.java index 1ed7eca63..96a005d34 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/datadict/DataDictDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/datadict/DataDictDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.datadict; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2AccessTokenDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2AccessTokenDO.java index a5baa0f6c..5cc3522d7 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2AccessTokenDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2AccessTokenDO.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth; import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2RefreshTokenDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2RefreshTokenDO.java index bf8d3adc1..b1bbc0d9b 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2RefreshTokenDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/oauth/OAuth2RefreshTokenDO.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth; import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java index 3fad4d62a..ce762eac0 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/AdminRoleDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java index a46265a5a..c04d8b56f 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/ResourceDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO; import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java index 7e5404a8b..1c6f25c28 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import cn.iocoder.mall.systemservice.enums.permission.RoleCodeEnum; import cn.iocoder.mall.systemservice.enums.permission.RoleTypeEnum; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java index 5381cb45e..5b145ff9d 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/permission/RoleResourceDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemAccessLogDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemAccessLogDO.java index 7775d3c34..14bf119e1 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemAccessLogDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemAccessLogDO.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog; import cn.iocoder.common.framework.enums.UserTypeEnum; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemExceptionLogDO.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemExceptionLogDO.java index 05bc6d871..69095e6fc 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemExceptionLogDO.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/dataobject/systemlog/SystemExceptionLogDO.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog; import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO; import cn.iocoder.mall.systemservice.enums.systemlog.SystemExceptionLogProcessStatusEnum; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/AdminMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/AdminMapper.java index 5dc443c1e..217ad7287 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/AdminMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/AdminMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.admin; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO; import cn.iocoder.mall.systemservice.service.admin.bo.AdminPageBO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/DepartmentMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/DepartmentMapper.java index a645c9eb3..96e41a017 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/DepartmentMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/admin/DepartmentMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.admin; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.DepartmentDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/ResourceMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/ResourceMapper.java index 37082147f..75f9c6032 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/ResourceMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/ResourceMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.ResourceDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/RoleMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/RoleMapper.java index 1c994276e..bd184f515 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/RoleMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/permission/RoleMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.RoleDO; import cn.iocoder.mall.systemservice.service.permission.bo.RolePageBO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemAccessLogMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemAccessLogMapper.java index 3b73048e9..49405b8a8 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemAccessLogMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemAccessLogMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.systemlog; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog.SystemAccessLogDO; import cn.iocoder.mall.systemservice.service.systemlog.bo.SystemAccessLogPageBO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemExceptionLogMapper.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemExceptionLogMapper.java index dd2716d1b..e5c8ec4db 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemExceptionLogMapper.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/systemlog/SystemExceptionLogMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.systemservice.dal.mysql.mapper.systemlog; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog.SystemExceptionLogDO; import cn.iocoder.mall.systemservice.service.systemlog.bo.SystemExceptionLogPageBO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/manager/permission/PermissionManager.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/manager/permission/PermissionManager.java index d4f8b565b..642ebf2e5 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/manager/permission/PermissionManager.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/manager/permission/PermissionManager.java @@ -18,7 +18,7 @@ import java.util.Collections; import java.util.Map; import java.util.Set; -import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum.FORBIDDEN; +import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.FORBIDDEN; /** * 权限 Manager diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java index 9899618b1..37d167dd2 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/AdminService.java @@ -17,7 +17,7 @@ import cn.iocoder.mall.systemservice.service.admin.bo.AdminUpdateBO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; @Service public class AdminService { diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/DepartmentService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/DepartmentService.java index 528d34708..dfd322c54 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/DepartmentService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/admin/DepartmentService.java @@ -17,7 +17,7 @@ import javax.validation.Valid; import java.util.Collection; import java.util.List; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; /** * 部门 Service diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/datadict/DataDictService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/datadict/DataDictService.java index 58488de34..695aafc0b 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/datadict/DataDictService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/datadict/DataDictService.java @@ -14,7 +14,7 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import java.util.List; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; /** * 数据字典 Service diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2Service.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2Service.java index ed466ce09..61b9fb58a 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2Service.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2Service.java @@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Date; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; /** * OAuth2.0 Service diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/PermissionService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/PermissionService.java index d757f9251..72f9cc158 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/PermissionService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/PermissionService.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.systemservice.service.permission; import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.common.framework.exception.GlobalException; import cn.iocoder.common.framework.util.CollectionUtils; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO; @@ -21,8 +22,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; -import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum.FORBIDDEN; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.FORBIDDEN; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; /** * 权限 Service @@ -151,7 +152,7 @@ public class PermissionService { // 权限验证 List roleResourceDOs = roleResourceMapper.selectListByResourceIds(permissionIds); if (CollectionUtil.isEmpty(roleResourceDOs)) { // 资源未授予任何角色,必然权限验证不通过 - throw ServiceExceptionUtil.exception(FORBIDDEN); + throw new GlobalException(FORBIDDEN); } Map> resourceRoleMap = CollectionUtils.convertMultiMap(roleResourceDOs, RoleResourceDO::getResourceId, RoleResourceDO::getRoleId); diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java index 3c77b0848..41ddb7e23 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/ResourceService.java @@ -7,7 +7,7 @@ import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.ResourceDO; import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.RoleResourceDO; import cn.iocoder.mall.systemservice.dal.mysql.mapper.permission.ResourceMapper; import cn.iocoder.mall.systemservice.dal.mysql.mapper.permission.RoleResourceMapper; -import cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum; +import cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants; import cn.iocoder.mall.systemservice.enums.permission.ResourceIdEnum; import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; import cn.iocoder.mall.systemservice.service.permission.bo.ResourceBO; @@ -22,7 +22,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; /** * 资源 Service @@ -83,11 +83,11 @@ public class ResourceService { public void deleteResource(Integer resourceId) { // 校验更新的资源是否存在 if (resourceMapper.selectById(resourceId) == null) { - throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.RESOURCE_NOT_EXISTS); + throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.RESOURCE_NOT_EXISTS); } // 校验是否还有子资源 if (resourceMapper.selectCountByPid(resourceId) > 0) { - throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.RESOURCE_EXISTS_CHILDREN); + throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.RESOURCE_EXISTS_CHILDREN); } // 校验删除的资源是否存在 if (resourceMapper.selectById(resourceId) == null) { diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/RoleService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/RoleService.java index 675035fb9..f800ac6e7 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/RoleService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/permission/RoleService.java @@ -26,7 +26,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*; /** * 角色 Service diff --git a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/systemlog/SystemExceptionLogService.java b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/systemlog/SystemExceptionLogService.java index 849e3b940..4742a5d98 100644 --- a/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/systemlog/SystemExceptionLogService.java +++ b/system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/systemlog/SystemExceptionLogService.java @@ -13,8 +13,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.SYSTEM_EXCEPTION_LOG_NOT_FOUND; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.SYSTEM_EXCEPTION_LOG_PROCESSED; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.SYSTEM_EXCEPTION_LOG_NOT_FOUND; +import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.SYSTEM_EXCEPTION_LOG_PROCESSED; /** * 系统异常日志 Service diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dao/errorcode/ErrorCodeMapper.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dao/errorcode/ErrorCodeMapper.java index 5314e8e79..5af6ed8cc 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dao/errorcode/ErrorCodeMapper.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dao/errorcode/ErrorCodeMapper.java @@ -1,11 +1,10 @@ package cn.iocoder.mall.system.biz.dao.errorcode; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.system.biz.dataobject.authorization.RoleDO; import cn.iocoder.mall.system.biz.dataobject.authorization.RoleResourceDO; import cn.iocoder.mall.system.biz.dataobject.errorcode.ErrorCodeDO; import cn.iocoder.mall.system.biz.dto.authorization.RolePageDTO; -import cn.iocoder.mall.system.biz.dto.errorcode.ErrorCodeDTO; import cn.iocoder.mall.system.biz.dto.errorcode.ErrorCodePageDTO; import cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum; import cn.iocoder.mall.system.biz.enums.errorcode.ErrorCodeTypeEnum; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java index 7e12dad65..b53c8f0ed 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/errorcode/ErrorCodeDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.system.biz.dataobject.errorcode; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSendLogDO.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSendLogDO.java index 372a2b8d1..2d9c7c33d 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSendLogDO.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSendLogDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.system.biz.dataobject.sms; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSignDO.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSignDO.java index 0b8b60972..de5310868 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSignDO.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsSignDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.system.biz.dataobject.sms; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsTemplateDO.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsTemplateDO.java index 86d0ce525..d0dfaeae8 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsTemplateDO.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/sms/SmsTemplateDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.system.biz.dataobject.sms; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java index 18d9ba624..f3e56f740 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/errorcode/ErrorCodeServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.system.biz.service.errorcode; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.system.biz.bo.errorcode.ErrorCodeBO; import cn.iocoder.mall.system.biz.convert.errorcode.ErrorCodeConvert; import cn.iocoder.mall.system.biz.dao.errorcode.ErrorCodeMapper; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/sms/SmsServiceImpl.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/sms/SmsServiceImpl.java index 820650686..56cddb602 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/sms/SmsServiceImpl.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/sms/SmsServiceImpl.java @@ -3,7 +3,7 @@ package cn.iocoder.mall.system.biz.service.sms; import cn.iocoder.common.framework.exception.ServiceException; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.system.biz.bo.smsSign.ListSmsSignBO; import cn.iocoder.mall.system.biz.bo.smsSign.SmsSignBO; import cn.iocoder.mall.system.biz.bo.smsTemplate.ListSmsTemplateBO; @@ -23,17 +23,14 @@ import cn.iocoder.mall.system.biz.dto.smsTemplate.ListSmsTemplateDTO; import cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum; import cn.iocoder.mall.system.biz.enums.sms.SmsApplyStatusEnum; import cn.iocoder.mall.system.biz.enums.sms.SmsPlatformEnum; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserServiceImpl.java b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserServiceImpl.java index f3c327117..6b11acd60 100644 --- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserServiceImpl.java +++ b/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserServiceImpl.java @@ -2,7 +2,6 @@ package cn.iocoder.mall.system.biz.service.user; import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; import cn.iocoder.mall.system.biz.bo.ouath2.OAuth2AuthenticateBO; import cn.iocoder.mall.system.biz.bo.user.UserAuthenticateBO; import cn.iocoder.mall.system.biz.bo.user.UserBO; @@ -17,7 +16,7 @@ import cn.iocoder.mall.system.biz.enums.user.UserStatusEnum; import cn.iocoder.mall.system.biz.service.oauth2.OAuth2Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; + import java.util.Arrays; import static cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum.*; diff --git a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java new file mode 100644 index 000000000..ace35cca4 --- /dev/null +++ b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java @@ -0,0 +1,30 @@ +package cn.iocoder.mall.userservice.enums; + +import cn.iocoder.common.framework.exception.ErrorCode; + +/** + * 错误码枚举类 + * + * user-service 服务,使用 1-002-000-000 段 + */ +public interface UserErrorCodeConstants { + + // ========== 用户手机验证码模块 ========== + ErrorCode USER_SMS_CODE_NOT_FOUND = new ErrorCode(1001001200, "验证码不存在"); + ErrorCode USER_SMS_CODE_EXPIRED = new ErrorCode(1001001201, "验证码已过期"); + ErrorCode USER_SMS_CODE_USED = new ErrorCode(1001001202, "验证码已使用"); + ErrorCode USER_SMS_CODE_NOT_CORRECT = new ErrorCode(1001001203, "验证码不正确"); + ErrorCode USER_SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY = new ErrorCode(1001001204, "超过每日短信发送数量"); + ErrorCode USER_SMS_CODE_SEND_TOO_FAST = new ErrorCode(1001001205, "短信发送过于频率"); + + // ========== 用户地址 ========== + ErrorCode USER_ADDRESS_NOT_EXISTENT = new ErrorCode(1001004000, "用户地址不存在!"); + ErrorCode USER_ADDRESS_IS_DELETED = new ErrorCode(1001004001, "用户地址已被删除!"); + ErrorCode USER_GET_ADDRESS_NOT_EXISTS = new ErrorCode(1001004002, "获取的地址不存在!"); + + // ========== 用户信息模块 1004004100 ========== + ErrorCode USER_NOT_EXISTS = new ErrorCode(1004004100, "用户不存在"); + ErrorCode USER_STATUS_NOT_EXISTS = new ErrorCode(1004004101, "用户状态不存在"); + ErrorCode USER_STATUS_EQUALS = new ErrorCode(1004004101, "用户已经是该状态"); + +} diff --git a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeEnum.java b/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeEnum.java deleted file mode 100644 index b4348cb03..000000000 --- a/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeEnum.java +++ /dev/null @@ -1,72 +0,0 @@ -package cn.iocoder.mall.userservice.enums; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; - -/** - * 错误码枚举类 - * - * system 系统,使用 1-002-000-000 段 - */ -public enum UserErrorCodeEnum implements ServiceExceptionUtil.Enumerable { - - // ========== OAUTH2 模块 ========== - OAUTH2_UNKNOWN(1001001000, "未知错误"), // 预留 - // 预留 1001001001 ~ 1001001099 错误码,方便前端 - OAUTH2_ACCESS_TOKEN_NOT_FOUND(1001001001, "访问令牌不存在"), - OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED(1001001002, "访问令牌已过期"), - OAUTH2_ACCESS_TOKEN_INVALID(1001001003, "访问令牌已失效"), - OAUTH2_NOT_AUTHENTICATE(1001001004, "账号未登陆"), - OAUTH2_REFRESH_TOKEN_NOT_FOUND(1001001005, "刷新令牌不存在"), - OAUTH_REFRESH_TOKEN_EXPIRED(1001001006, "访问令牌已过期"), - OAUTH_REFRESH_TOKEN_INVALID(1001001007, "刷新令牌已失效"), - // 其它 1001001100 开始 - OAUTH2_ACCOUNT_NOT_FOUND(1001001100, "账号不存在"), - OAUTH2_ACCOUNT_PASSWORD_ERROR(1001001101, "密码不正确"), - - // ========== 用户手机验证码模块 ========== - USER_SMS_CODE_NOT_FOUND(1001001200, "验证码不存在"), - USER_SMS_CODE_EXPIRED(1001001201, "验证码已过期"), - USER_SMS_CODE_USED(1001001202, "验证码已使用"), - USER_SMS_CODE_NOT_CORRECT(1001001203, "验证码不正确"), - USER_SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY(1001001204, "超过每日短信发送数量"), - USER_SMS_CODE_SEND_TOO_FAST(1001001205, "短信发送过于频率"), - - // ========== 用户地址 ========== - USER_ADDRESS_NOT_EXISTENT(1001004000, "用户地址不存在!"), - USER_ADDRESS_IS_DELETED(1001004001, "用户地址已被删除!"), - USER_GET_ADDRESS_NOT_EXISTS(1001004002, "获取的地址不存在!"), - - // ========== 用户信息模块 1004004100 ========== - USER_NOT_EXISTS(1004004100, "用户不存在"), - USER_STATUS_NOT_EXISTS(1004004101, "用户状态不存在"), - USER_STATUS_EQUALS(1004004101, "用户已经是该状态"), - - ; - - - private final int code; - private final String message; - - UserErrorCodeEnum(int code, String message) { - this.code = code; - this.message = message; - } - - @Override - public int getCode() { - return code; - } - - @Override - public String getMessage() { - return message; - } - - // TODO: 2020-05-22 封装成start的时候,直接在start中定义一个统一的枚举,从中取值; - @Override - public int getGroup() { - return 0; - } - - -} diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/config/ServiceExceptionConfiguration.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/config/ServiceExceptionConfiguration.java index 566dbf356..8a9596bdc 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/config/ServiceExceptionConfiguration.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/config/ServiceExceptionConfiguration.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.userservice.config; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.userservice.enums.UserErrorCodeEnum; +import cn.iocoder.mall.userservice.enums.UserErrorCodeConstants; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.annotation.Configuration; import org.springframework.context.event.EventListener; @@ -13,7 +13,7 @@ public class ServiceExceptionConfiguration { @EventListener(ApplicationReadyEvent.class) public void initMessages() { - Arrays.stream(UserErrorCodeEnum.values()).forEach( + Arrays.stream(UserErrorCodeConstants.values()).forEach( item -> ServiceExceptionUtil.put(item.getCode(), item.getMessage())); } diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java index d0aaa141e..8b459b98a 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.userservice.dal.mysql.dataobject.sms; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import cn.iocoder.mall.userservice.enums.sms.UserSmsSceneEnum; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java index 48366dc96..0a9254b79 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.userservice.dal.mysql.dataobject.user; import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java index fce05e6ae..6a02b2c64 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.userservice.dal.mysql.mapper.sms; -import cn.iocoder.mall.mybatis.query.QueryWrapperX; +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.userservice.dal.mysql.dataobject.sms.UserSmsCodeDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; diff --git a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java index ab4d4a238..f3a1f7588 100644 --- a/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java +++ b/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java @@ -12,7 +12,7 @@ import org.springframework.validation.annotation.Validated; import java.util.Date; -import static cn.iocoder.mall.userservice.enums.UserErrorCodeEnum.*; +import static cn.iocoder.mall.userservice.enums.UserErrorCodeConstants.*; @Service @Validated diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UsersUserAddressDO.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UsersUserAddressDO.java index decc62027..c294d4379 100644 --- a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UsersUserAddressDO.java +++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UsersUserAddressDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.user.biz.dataobject.user; -import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java index dee915614..c36c74d8d 100644 --- a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java +++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.user.biz.service.user; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; +import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.user.biz.bo.user.UserAddressBO; import cn.iocoder.mall.user.biz.convert.user.UserAddressConvert; import cn.iocoder.mall.user.biz.dao.user.UserAddressMapper;