作者 郑周

Merge branch 'dev-zhengzhou' into test

... ... @@ -6,7 +6,7 @@ import (
type EditParentCommand struct {
Id int64 `cname:"用户ID" json:"id,string" valid:"Required"`
ParentId int64 `cname:"上级ID" json:"parentId,string" valid:"Required"`
ParentId int64 `cname:"上级ID" json:"parentId"`
CompanyId int `cname:"公司ID" json:"companyId"`
OperatorId int `cname:"操作人ID" json:"operatorId"`
}
... ...
... ... @@ -148,10 +148,13 @@ func (us *UserService) EditParentUser(in *command.EditParentCommand) error {
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 上级ID是否存在
_, err = userRepo.FindOne(map[string]interface{}{"id": in.ParentId})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
if in.ParentId != 0 {
// 上级ID是否存在
_, err = userRepo.FindOne(map[string]interface{}{"id": in.ParentId})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
user.ParentId = in.ParentId
... ...