Преглед изворни кода

医生角色 如果accountid和useraccount表id不一致更新这id

pzc пре 4 година
родитељ
комит
7fd7f092bc

+ 9 - 1
ymall/src/main/java/com/liangjian11/ymall/service/impl/DoctorServiceImpl.java

@@ -374,8 +374,16 @@ public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> impleme
       QueryWrapper<UserRole> userRoleQuery = new QueryWrapper<>();
       userRoleQuery.eq("user_role_type", 1);
       userRoleQuery.eq("mobile", enPhone);
-      if (userRoleService.getOne(userRoleQuery) == null)
+      UserRole userRole = userRoleService.getOne(userRoleQuery);
+      if (userRole == null)
         userRoleService.addUserRole(userAccount, enPhone, userAccount.getNickname(), userAccount.getHeadimg(), doctorList.get(0).getId(), 1, 1);
+      else{
+//        QueryWrapper<UserAccount> userAccQuery = new QueryWrapper<>();
+//        userAccQuery.eq("mobile", enPhone);
+//        UserAccount userAccount1 = userAccountMapper.selectOne(userAccQuery);
+        userRole.setAccountId(userAccount.getId());
+        userRoleService.updateById(userRole);
+      }
       if(doctorList.get(0).getCheckStatus()!=null && doctorList.get(0).getCheckStatus().equals(2)){
         Cookie cookie=new Cookie("redirectCode","personalInfo");
         cookie.setPath("/");