Selaa lähdekoodia

fix: 改用显式 LambdaUpdateWrapper + baseMapper.update(null, wrapper) 确保角色权限保存

MPJBaseServiceImpl 的 lambdaUpdate() 链式 update() 可能受 mybatis-plus-join 影响行为不一致。
改为 MyBatis-Plus 标准显式模式: new LambdaUpdateWrapper<>() → baseMapper.update(null, wrapper)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 1 päivä sitten
vanhempi
säilyke
ab23f91dd5

+ 7 - 5
car-wash-service/src/main/java/com/kym/service/impl/RoleServiceImpl.java

@@ -1,6 +1,6 @@
 package com.kym.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.kym.common.utils.CommUtil;
 import com.kym.entity.Role;
@@ -50,10 +50,12 @@ public class RoleServiceImpl extends MPJBaseServiceImpl<RoleMapper, Role> implem
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void saveList(List<Role> roleList) {
-        roleList.forEach(role -> lambdaUpdate()
-                .eq(Role::getId, role.getId())
-                .set(Role::getPermissions, role.getPermissions())
-                .update());
+        roleList.forEach(role -> {
+            LambdaUpdateWrapper<Role> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(Role::getId, role.getId())
+                   .set(Role::getPermissions, role.getPermissions());
+            baseMapper.update(null, wrapper);
+        });
     }
 
     @Override