예제 #1
0
        /// <summary>
        /// 非该角色用户 分页查询
        /// </summary>
        /// <param name="queryParam"></param>
        /// <returns></returns>
        public QueryResult <SysUser> QueryIsNotRole(SysRoleUserQueryParam queryParam)
        {
            QueryResult <SysUser> result = new QueryResult <SysUser>();
            var totalCount = 0;

            result.List = SqlSugarClient.Queryable <SysUser>()
                          .Where(u => u.Status == Model.Enum.Status.正常 && SqlFunc.Subqueryable <SysRoleUser>().Where(ru => ru.RoleId == queryParam.RoleId && ru.Status == Model.Enum.Status.正常 && ru.UserId == u.Id).NotAny())
                          .WhereIF(!string.IsNullOrWhiteSpace(queryParam.Key), f => f.Account.Contains(queryParam.Key) || f.Name.Contains(queryParam.Key) || f.Phone.Contains(queryParam.Key) || f.Adress.Contains(queryParam.Key))
                          .WhereIF(queryParam.Gender != null, f => f.Gender == queryParam.Gender)
                          .ToPageList(queryParam.PageIndex, queryParam.PageSize, ref totalCount);
            result.Total = totalCount;
            return(result);
        }
예제 #2
0
        /// <summary>
        /// 该角色用户 query
        /// </summary>
        /// <param name="queryParam"></param>
        /// <returns></returns>
        public QueryResult <SysRoleUserDto> Query(SysRoleUserQueryParam queryParam)
        {
            var r = SysRoleUserRepository.Query(queryParam);

            r.List = r.List.Select(f =>
            {
                var d = new SysRoleUserDto();
                d.CopyFrom(f);
                d.HeadImgUrl = SysFileRelationService.GetUserHeadImgPath(d.Id, Model.Enum.UploadType.UserPicture);
                return(d);
            }).ToList();
            return(r);
        }
예제 #3
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="queryParam"></param>
        /// <returns></returns>
        public QueryResult <SysRoleUserDto> Query(SysRoleUserQueryParam queryParam)
        {
            QueryResult <SysRoleUserDto> result = new QueryResult <SysRoleUserDto>();
            var totalCount = 0;

            result.List = SqlSugarClient.Queryable <SysRoleUser, SysUser>((ru, u) =>
                                                                          new object[] { JoinType.Inner, ru.UserId == u.Id })
                          .Where((ru, u) => ru.Status == Model.Enum.Status.正常 && u.Status == Model.Enum.Status.正常 && ru.RoleId == queryParam.RoleId)
                          .WhereIF(!string.IsNullOrWhiteSpace(queryParam.Key), (ru, u) => u.Name.Contains(queryParam.Key) || u.Account.Contains(queryParam.Key) || u.Phone.Contains(queryParam.Key))
                          .WhereIF(queryParam.Gender != null, (ru, u) => u.Gender == queryParam.Gender)
                          .Select((ru, u) => new SysRoleUserDto()
            {
                Name = u.Name, Account = u.Account, Adress = u.Adress, Birthday = u.Birthday, Gender = u.Gender, Id = u.Id, Phone = u.Phone, RoleUserId = ru.Id
            })
                          .ToPageList(queryParam.PageIndex, queryParam.PageSize, ref totalCount);
            result.Total = totalCount;
            return(result);
        }
        public object QueryIsNotRole([FromQuery] SysRoleUserQueryParam queryParam)
        {
            var r = SysRoleUserService.QueryIsNotRole(queryParam);

            return(r);
        }