Просмотр исходного кода

fix(resource): 修复 ResourceService 中 PearlInteractionLogMapper 的 Bean 名冲突

问题:ResourceService 字段名 interactionLogMapper 与 MyBatis-Plus
自动注入的 InteractionLogMapper Bean 默认名称 collision,
启动时报 BeanNotOfRequiredTypeException。

修复:将字段名改为 pearlInteractionLogMapper,消除名称冲突,
符合 AGENTS.md DI 规范(字段名与类型默认 Bean Name 一致)。
Xiaogang Liao 1 неделя назад
Родитель
Сommit
7b754f4692

+ 4 - 4
cfc-backend/src/main/java/com/etotem/cfc/service/ResourceService.java

@@ -43,7 +43,7 @@ public class ResourceService {
     private ContactHelpLogMapper helpLogMapper;
 
     @Resource
-    private PearlInteractionLogMapper interactionLogMapper;
+    private PearlInteractionLogMapper pearlInteractionLogMapper;
 
     @Resource
     private PearlInteractionReminderMapper reminderMapper;
@@ -212,12 +212,12 @@ public class ResourceService {
         log.setContent(content != null ? content.trim() : null);
         log.setHappenedAt(new Date());
         log.setCreatedAt(new Date());
-        interactionLogMapper.insert(log);
+        pearlInteractionLogMapper.insert(log);
 
         item.setLastInteractionAt(log.getHappenedAt());
         item.setInteractionCount((item.getInteractionCount() == null ? 0 : item.getInteractionCount()) + 1);
         // 重新计算价值分(互动后价值提升)
-        List<PearlInteractionLog> logs = interactionLogMapper.selectList(
+        List<PearlInteractionLog> logs = pearlInteractionLogMapper.selectList(
                 new LambdaQueryWrapper<PearlInteractionLog>()
                         .eq(PearlInteractionLog::getResourceItemId, itemId)
                         .orderByDesc(PearlInteractionLog::getHappenedAt)
@@ -242,7 +242,7 @@ public class ResourceService {
         if (item == null || !item.getUserId().equals(userId)) {
             return Result.error("资源不存在");
         }
-        List<PearlInteractionLog> logs = interactionLogMapper.selectList(
+        List<PearlInteractionLog> logs = pearlInteractionLogMapper.selectList(
                 new LambdaQueryWrapper<PearlInteractionLog>()
                         .eq(PearlInteractionLog::getResourceItemId, itemId)
                         .orderByDesc(PearlInteractionLog::getHappenedAt)