using Furion.DependencyInjection; using Nirvana.Common; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using YBDevice.CommonService; using YBDevice.Entity; namespace YBDevice.Application.RegUserInfo { /// /// 注册用户管理 /// public class UserService : IUserService, ITransient { private readonly ISqlSugarRepository repository; private readonly SqlSugarClient dbClient; private readonly ICommonService _commonService; private readonly OperatorModel currentUser; public UserService(ISqlSugarRepository sqlSugarRepository,ICommonService commonService) { repository = sqlSugarRepository; dbClient = repository.Context; _commonService = commonService; currentUser = BaseInfoService.GetUserInfo(); } /// /// 注册用户列表 /// /// /// public async Task> GetListAsync(QueryParams param) { RefAsync totalnum = 0; var temquery = dbClient.Queryable(); if (param.queryParam != null && param.queryParam.Count > 0) { List conModels = new List(); param.queryParam.ForEach(x => { if (!string.IsNullOrEmpty(x.Value)) { conModels.Add(new ConditionalModel() { FieldName = x.Name, ConditionalType = (ConditionalType)x.Type, FieldValue = x.Value.Trim() }); } }); if (conModels.Count > 0) { temquery = temquery.Where(conModels); } } string sorts = string.Format("{0} {1}", param.sort, param.order); var query = await temquery.OrderBy(sorts) .Mapper((it, cache) => { it.Headimg = string.IsNullOrEmpty(it.Headimg) ? DefaultService.HeadImg(it.Gender, FamilyType.Adult) : it.Headimg; }) .ToPageListAsync(param.offset, param.limit, totalnum); return new PageParms { page = param.offset, Items = query, totalnum = totalnum, limit = param.limit }; } } }