zhangqian
2023-10-31 5f0170df9787c6f3ff17cc168b3f2e3f511453f6
model/user.go
@@ -26,7 +26,7 @@
      MenuIds      []uint            `json:"menuIds" gorm:"-"`                              // 菜单ID列表
      AuthorityId  uint              `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID
      Authority    Authority         `json:"authority" gorm:"foreignKey:AuthorityId"`
      SubUserIds   string            `json:"subUserIds" gorm:"sub_user_ids"` //下属员工用户id,用逗号分开
      SubUserIds   *string           `json:"subUserIds" gorm:"sub_user_ids"` //下属员工用户id,用逗号分开
      gorm.Model   `json:"-"`
   }
@@ -303,13 +303,13 @@
   } else if old.Username != record.Username ||
      old.UserType != record.UserType ||
      old.NickName != record.NickName ||
      old.SubUserIds != record.SubUserIds {
      record.SubUserIds != nil && old.SubUserIds != record.SubUserIds {
      old.Username = record.Username
      old.UserType = record.UserType
      old.NickName = record.NickName
      old.SubUserIds = record.SubUserIds
      if err := db.Updates(&record).Error; err != nil {
         return fmt.Errorf("update user err: %v, record: %+v", err, record)
         return fmt.Errorf("update user err: %v, old record: %+v", err, old)
      }
   }