新增:权限分组模块
This commit is contained in:
parent
73ee2281b9
commit
ba551fb724
|
@ -36,7 +36,7 @@ func NewDeleteLdapGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *D
|
|||
func (l *DeleteLdapGroupLogic) DeleteLdapGroup(req *types.DeleteLdapGroupReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
resLdapGroup, err := l.svcCtx.AllModels.LdapGroup.FindOneById(l.ctx, req.Id)
|
||||
resLdapGroupInfo, err := l.svcCtx.AllModels.LdapGroup.FindOneById(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
basic.CodeServiceErr.Message = "记录不存在"
|
||||
|
@ -47,15 +47,15 @@ func (l *DeleteLdapGroupLogic) DeleteLdapGroup(req *types.DeleteLdapGroupReq, us
|
|||
}
|
||||
txErr := l.svcCtx.MysqlConn.WithContext(l.ctx).Transaction(func(tx *gorm.DB) error {
|
||||
//删除权限组、权限组相关
|
||||
resLdapGroupDel := tx.Delete(&resLdapGroup)
|
||||
resLdapGroupDel := tx.Delete(&resLdapGroupInfo)
|
||||
if resLdapGroupDel.Error != nil {
|
||||
return resLdapGroupDel.Error
|
||||
}
|
||||
resLdapUserGroupDel := tx.Where("group_id = ?", resLdapGroup.Id).Delete(&gmodel.LdapUserGroup{})
|
||||
resLdapUserGroupDel := tx.Where("group_id = ?", resLdapGroupInfo.Id).Delete(&gmodel.LdapUserGroup{})
|
||||
if resLdapUserGroupDel.Error != nil {
|
||||
return resLdapUserGroupDel.Error
|
||||
}
|
||||
resLdapGroupMenusDel := tx.Where("group_id = ?", resLdapGroup.Id).Delete(&gmodel.LdapGroupMenus{})
|
||||
resLdapGroupMenusDel := tx.Where("group_id = ?", resLdapGroupInfo.Id).Delete(&gmodel.LdapGroupMenus{})
|
||||
if resLdapGroupMenusDel.Error != nil {
|
||||
return resLdapGroupMenusDel.Error
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user