Parcourir la source

修复无员工信息时无法插入员工的问题

zhontai il y a 2 ans
Parent
commit
e889070fa1
1 fichiers modifiés avec 1 ajouts et 2 suppressions
  1. 1 2
      src/platform/ZhonTai.Admin/Services/User/UserService.cs

+ 1 - 2
src/platform/ZhonTai.Admin/Services/User/UserService.cs

@@ -316,7 +316,6 @@ public class UserService : BaseService, IUserService, IDynamicApi
         var entity = Mapper.Map<UserEntity>(input);
         entity.Type = UserType.DefaultUser;
         var user = await _userRepository.InsertAsync(entity);
-
         var userId = user.Id;
 
         //用户角色
@@ -331,7 +330,7 @@ public class UserService : BaseService, IUserService, IDynamicApi
         }
 
         // 员工信息
-        var staff = Mapper.Map<UserStaffEntity>(input.Staff);
+        var staff = input.Staff == null ? new UserStaffEntity() : Mapper.Map<UserStaffEntity>(input.Staff);
         staff.Id = userId;
         await _staffRepository.InsertAsync(staff);