From 377fa0aadfe985782545177aee4ff312aa81bed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sun, 12 Dec 2021 13:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=88=86=E9=85=8D=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/System/SysRoleController.cs | 15 +++++++++------ ZR.Service/System/IService/ISysRoleService.cs | 6 +++--- ZR.Service/System/SysRoleService.cs | 6 +++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs index 5c1859a..800ad0f 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs @@ -129,15 +129,18 @@ namespace ZR.Admin.WebApi.Controllers.System if (sysRoleDto == null || sysRoleDto.RoleId <= 0) return ToResponse(ApiResult.Error(101, "请求参数错误")); sysRoleDto.Create_by = HttpContext.GetName(); - //删除角色菜单 - sysRoleService.DeleteRoleMenuByRoleId(sysRoleDto.RoleId); - sysRoleService.InsertRoleMenu(sysRoleDto); + bool result = sysRoleService.UseTran2(() => + { + //删除角色菜单 + sysRoleService.DeleteRoleMenuByRoleId(sysRoleDto.RoleId); + sysRoleService.InsertRoleMenu(sysRoleDto); + }); - return SUCCESS(true); + return SUCCESS(result); } /// - /// 角色删除 √ + /// 角色删除 /// /// /// @@ -153,7 +156,7 @@ namespace ZR.Admin.WebApi.Controllers.System } /// - /// 修改角色状态 √ + /// 修改角色状态 /// /// 角色对象 /// diff --git a/ZR.Service/System/IService/ISysRoleService.cs b/ZR.Service/System/IService/ISysRoleService.cs index 9c9f4a4..2df2b54 100644 --- a/ZR.Service/System/IService/ISysRoleService.cs +++ b/ZR.Service/System/IService/ISysRoleService.cs @@ -4,7 +4,7 @@ using ZR.Model.System; namespace ZR.Service.System.IService { - public interface ISysRoleService + public interface ISysRoleService : IBaseService { /// /// 根据条件分页查询角色数据 @@ -12,7 +12,7 @@ namespace ZR.Service.System.IService /// 角色信息 /// /// 角色数据集合信息 - public PagedInfo SelectRoleList(SysRole role, Model.PagerInfo pager); + public PagedInfo SelectRoleList(SysRole role, PagerInfo pager); /// /// 查询所有角色 @@ -113,7 +113,7 @@ namespace ZR.Service.System.IService /// /// public List SelectUserRoles(long userId); - + /// /// 获取用户权限字符串集合 /// diff --git a/ZR.Service/System/SysRoleService.cs b/ZR.Service/System/SysRoleService.cs index f0df631..d04a820 100644 --- a/ZR.Service/System/SysRoleService.cs +++ b/ZR.Service/System/SysRoleService.cs @@ -17,14 +17,14 @@ namespace ZR.Service /// 角色 /// [AppService(ServiceType = typeof(ISysRoleService), ServiceLifetime = LifeTime.Transient)] - public class SysRoleService: ISysRoleService + public class SysRoleService : BaseService, ISysRoleService { private SysRoleRepository SysRoleRepository; private ISysUserRoleService SysUserRoleService; public SysRoleService( - SysRoleRepository sysRoleRepository, - ISysUserRoleService sysUserRoleService) + SysRoleRepository sysRoleRepository, + ISysUserRoleService sysUserRoleService) : base(sysRoleRepository) { SysRoleRepository = sysRoleRepository; SysUserRoleService = sysUserRoleService;