Пример #1
0
        /// <summary>
        /// 查询所有用户
        /// </summary>
        /// <param name="groupId">组标识</param>
        /// <returns></returns>
        public List <ImUserInfoPo> QueryAllUser(Guid groupId)
        {
            #region sql script
            string sql = string.Format(@"SELECT top 100000
	                                        ui.ImUserId,
	                                        ISNULL(ug.NickName,ui.ImUserName) AS 'ImUserName',
	                                        ui.UserHeadimg,
	                                        ui.UserId,
	                                        ui.UserType,
	                                        ui.Remark,
	                                        ui.CreateTime,
	                                        ui.UpdateTime,
	                                        ui.IsValid
                                        FROM    
	                                        dbo.UserGroup ug WITH(NOLOCK)
                                            LEFT JOIN dbo.ImUserInfo ui WITH(NOLOCK) ON ug.ImUserId = ui.ImUserId
                                        WHERE   
	                                        ug.IsValid = 1
                                            AND ui.IsValid = 1
	                                        AND ug.GroupId='{0}'
                                        ORDER BY 
		                                        ug.CreateTime ASC"        , groupId.ToString());
            #endregion

            var data = CurrentDbContext.SqlQueryable <ImUserInfoPo>(sql).ToList();

            return(data);
        }