feat(user): 动态查询VIP角色ID,避免硬编码绑定问题
- RoleParam新增tenantId字段,支持按租户过滤角色 - 新增getCurrentTenantId函数,兼容登录态及默认租户回退 - 实现getVipRoleId函数,按roleCode与tenantId查询VIP角色ID - assignVipRole动态获取VIP角色ID,移除写死的角色ID - 添加用户角色时传入tenantId,确保多租户环境中角色绑定正确 - 修复后端UserRoleController.save接口bug,避免userId被无条件覆盖 - 用户角色绑定时正确使用申请人userId,解决VIP审核角色误绑定问题
This commit is contained in:
8
.workbuddy/memory/2026-07-22.md
Normal file
8
.workbuddy/memory/2026-07-22.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# 2026-07-22
|
||||
|
||||
## 修复 UserRoleController.save 覆盖 userId 的 bug
|
||||
- 文件:`com.gxwebsoft.core/.../system/controller/UserRoleController.java`
|
||||
- 问题:原 `save` 用 `getLoginUser().getUserId()` **无条件覆盖**请求体 userId,导致 VIP 审核通过时角色绑到店员而非申请人。
|
||||
- 修复:改为 `if (userRole.getUserId() == null && loginUser != null) userRole.setUserId(loginUser.getUserId());`(仅当请求体未传 userId 时回退到登录用户)。
|
||||
- 影响:VIP 审核 `addUserRole({ userId: item.userId, ... })` 现在能正确把角色绑给申请人;其它不传 userId 的调用方行为不变。
|
||||
- 注意:UserRole 的 `tenantId` 由 MyBatis-Plus 多租户插件按请求头自动写入 INSERT,前端传的 tenantId 仅作冗余。
|
||||
Reference in New Issue
Block a user