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);