/// <summary>
        /// 根据功能项获取权限信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task <IEnumerable <SystemPermission> > GetSystemPermissionsMvcRote(GetSystemPermissionsMvcRoteInput input)
        {
            StringBuilder sql = new StringBuilder(string.Format(@"SELECT per.PrivilegeAccess FROM dbo.System_Permission per
                                                    LEFT JOIN dbo.System_PermissionUser perUser ON perUser.PrivilegeMasterValue = per.PrivilegeMasterValue WHERE perUser.PrivilegeMasterUserId=@userId
                                                    AND per.PrivilegeAccessValue IN(
                                                    SELECT menuButtonFunc.MenuButtonId FROM dbo.System_MenuButtonFunction menuButtonFunc
                                                    LEFT JOIN  dbo.System_Function func ON func.FunctionId = menuButtonFunc.FunctionId
                                                    WHERE AppCode=@appCode AND Area=@area AND Controller=@controller AND [Action]=@action)
                                                    AND per.PrivilegeAccess={0}", (byte)EnumPrivilegeAccess.菜单按钮));

            sql.Append(" UNION ALL ");
            sql.Append(string.Format(@" SELECT per.PrivilegeAccess FROM dbo.System_Permission per
                                                    LEFT JOIN dbo.System_PermissionUser perUser ON perUser.PrivilegeMasterValue = per.PrivilegeMasterValue WHERE perUser.PrivilegeMasterUserId=@userId
                                                    AND per.PrivilegeAccessValue IN(
                                                    SELECT menu.MenuId FROM dbo.System_Menu menu
                                                    WHERE menu.AppId=@appId AND menu.Area=@area AND Controller=@controller AND [Action]=@action)
                                                    AND per.PrivilegeAccess={0}", (byte)EnumPrivilegeAccess.菜单));
            return(SqlMapperUtil.SqlWithParams <SystemPermission>(sql.ToString(), new
            {
                userId = input.UserId,
                appId = input.AppId,
                area = input.Area,
                controller = input.Controller,
                action = input.Action
            }));
        }
Example #2
0
 /// <summary>
 /// 根据功能项获取权限信息
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task <IEnumerable <SystemPermission> > GetSystemPermissionsMvcRote(GetSystemPermissionsMvcRoteInput input)
 {
     return((await _permissionRepository.GetSystemPermissionsMvcRote(input)).ToList());
 }