diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoService.java index 67f7077e..ba55e2b4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoService.java @@ -21,7 +21,7 @@ public interface AdminOauthUserOtherInfoService { */ void checkInsert(Long userId, String appId, String openId, Integer socialType); - AdminOauthUserOtherInfoDO getByCondition(Long userId, String appId, String openId, Integer socialType); + AdminOauthUserOtherInfoDO getByCondition(Long userId, Integer socialType); /** * 通过社交类型+用户状态获取用户社交信息 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoServiceImpl.java index 46368782..b3c749cc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminOauthUserOtherInfoServiceImpl.java @@ -24,22 +24,24 @@ public class AdminOauthUserOtherInfoServiceImpl implements AdminOauthUserOtherIn @Override public void checkInsert(Long userId, String appId, String openId, Integer socialType) { - AdminOauthUserOtherInfoDO adminOauthUserOtherInfoDOS = this.getByCondition(userId, appId, openId, socialType); + AdminOauthUserOtherInfoDO adminOauthUserOtherInfoDOS = this.getByCondition(userId, socialType); if (adminOauthUserOtherInfoDOS == null) { adminOauthUserOtherInfoMapper.insert(new AdminOauthUserOtherInfoDO() .setUserId(userId) .setAppId(appId) .setOpenId(openId) .setSocialType(socialType)); + } else { + if (!adminOauthUserOtherInfoDOS.getOpenId().equals(openId)) { + adminOauthUserOtherInfoMapper.updateById(adminOauthUserOtherInfoDOS.setOpenId(openId)); + } } } @Override - public AdminOauthUserOtherInfoDO getByCondition(Long userId, String appId, String openId, Integer socialType) { + public AdminOauthUserOtherInfoDO getByCondition(Long userId, Integer socialType) { return adminOauthUserOtherInfoMapper.selectOne(new LambdaQueryWrapper() .eq(AdminOauthUserOtherInfoDO::getUserId, userId) - .eq(AdminOauthUserOtherInfoDO::getAppId, appId) - .eq(AdminOauthUserOtherInfoDO::getOpenId, openId) .eq(AdminOauthUserOtherInfoDO::getSocialType, socialType)); }