From 568859ce352c5edf95ee88240b36bb2e7039c263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=9A=E8=BE=B0=E5=85=88=E7=94=9F?= Date: Tue, 3 Dec 2024 20:12:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=88=90=E5=8A=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/.cursorrules | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/.cursorrules b/backend/.cursorrules index a1266d62..26e4e8cc 100644 --- a/backend/.cursorrules +++ b/backend/.cursorrules @@ -22,7 +22,7 @@ - 对象转换:使用MapStruct进行转换,继承BaseConverter,显式声明特殊映射 ### Service层规范 -- 简单CRUD继承BaseServiceImpl,复杂业务需定义专门接口和实现,包含事务控制和异常处理 +- 简单CRUD继承com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl,复杂业务需定义专门接口和实现,包含事务控制和异常处理 - 使用@Transactional注解控制事务,合理设置事务传播机制和隔离级别 - 实现乐观锁(@Version)或悲观锁(findByIdWithLock)进行并发控制 - 使用@Resource 注入其他BEAN,不要使用构造方法 @@ -41,7 +41,7 @@ public class ExternalSystemServiceImpl extends BaseServiceImpl - 统一使用GlobalExceptionHandler处理异常 - 使用@Resource 注入其他BEAN,不要使用构造方法 @@ -63,7 +63,7 @@ public class ExternalSystemApiController extends BaseController,使用@jakarta.persistence.Entity注解 - 示例: ```java @Data @@ -125,7 +126,7 @@ public class ExternalSystem extends Entity { - 增加枚举时,不要修改现有没有,只追加即可 ### 异常规范 -- 异常分为系统异常应继承SystemException和业务异常应承BusinessException,使用ResponseCode定义错误码,在messages.properties中定义错误消息 +- 异常分为系统异常应继承com.qqchen.deploy.backend.framework.exception.SystemException和业务异常应承com.qqchen.deploy.backend.framework.exception.BusinessException,使用ResponseCode定义错误码,在messages.properties中定义错误消息 - 示例 throw new BusinessException(ResponseCode.EXTERNAL_SYSTEM_DISABLED);