|
|
|
@ -27,6 +27,9 @@ func (s *Rpc) GetBaseRole(ctx context.Context, in *BaseRoleProto.ModelArg) (*Bas
|
|
|
|
|
var reply BaseRoleProto.Reply
|
|
|
|
|
//通用获取单条
|
|
|
|
|
list := SqlKit.QueryByIds([]string{in.RoleId}, "t_base_role")
|
|
|
|
|
//扩展它的与对应系统AppIds的关系
|
|
|
|
|
releation, _ := BaseRoleDao.GetRoleAppRepleation(list[0]["role_id"].(string))
|
|
|
|
|
list[0]["app_info"] = releation
|
|
|
|
|
//将结果序列化
|
|
|
|
|
reply.Success = true
|
|
|
|
|
reply.Count = 1
|
|
|
|
@ -79,7 +82,7 @@ func (s *Rpc) AddBaseRole(ctx context.Context, in *BaseRoleProto.ModelArg) (*Bas
|
|
|
|
|
// 增加角色与系统的关联关系
|
|
|
|
|
for i := 0; i < len(in.AppIds); i++ {
|
|
|
|
|
model2 := new(models.TBaseRoleApp)
|
|
|
|
|
model2.Id=CommonUtil.GetUUID()
|
|
|
|
|
model2.Id = CommonUtil.GetUUID()
|
|
|
|
|
model2.AppId = in.AppIds[i]
|
|
|
|
|
model2.RoleId = model.RoleId
|
|
|
|
|
model2.BUse = 1
|
|
|
|
@ -139,7 +142,6 @@ func (s *Rpc) UpdateBaseRole(ctx context.Context, in *BaseRoleProto.ModelArg) (*
|
|
|
|
|
model := new(models.TBaseRole)
|
|
|
|
|
model.RoleId = in.RoleId
|
|
|
|
|
model.IdentityId = in.IdentityId
|
|
|
|
|
|
|
|
|
|
model.BUse = in.BUse
|
|
|
|
|
_, err := BaseRoleDao.UpdateBaseRole(*model, in.ForceUpdateFields)
|
|
|
|
|
//错误处理
|
|
|
|
@ -149,6 +151,24 @@ func (s *Rpc) UpdateBaseRole(ctx context.Context, in *BaseRoleProto.ModelArg) (*
|
|
|
|
|
LogUtil.Error(ErrorConst.SqlUpdateError, "执行UpdateBaseRole时发生严重错误:"+err.Error())
|
|
|
|
|
return &reply, err
|
|
|
|
|
}
|
|
|
|
|
//对应表需要先删除再插入
|
|
|
|
|
BaseRoleDao.DeleteRoleAppRepleation(model.RoleId)
|
|
|
|
|
// 增加角色与系统的关联关系
|
|
|
|
|
for i := 0; i < len(in.AppIds); i++ {
|
|
|
|
|
model2 := new(models.TBaseRoleApp)
|
|
|
|
|
model2.Id = CommonUtil.GetUUID()
|
|
|
|
|
model2.AppId = in.AppIds[i]
|
|
|
|
|
model2.RoleId = model.RoleId
|
|
|
|
|
model2.BUse = 1
|
|
|
|
|
_, err = BaseRoleDao.AddRoleAppReleation(*model2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
reply.Success = false
|
|
|
|
|
reply.Message = Const.DataBaseActionError
|
|
|
|
|
LogUtil.Error(ErrorConst.SqlUpdateError, "执行AddRoleAppReleation时发生严重错误:"+err.Error())
|
|
|
|
|
return &reply, err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reply.Success = true
|
|
|
|
|
reply.Message = Const.SuccessDataBaseAction
|
|
|
|
|
return &reply, nil
|
|
|
|
|