using AutoMapper; using OASystem.Domain; using OASystem.Domain.Entities.System; using OASystem.Domain.ViewModels.System; using StackExchange.Redis; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OASystem.Infrastructure.Repositories.System { public class UsersRepository : BaseRepository { private readonly IMapper _mapper; public UsersRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar) { _mapper = mapper; } /// /// 用户查询列表 /// /// /// public async Task GetUserList(int portType,string sqlWhere) { Result result = new Result(); string userSqlWhere = string.Format(@"Select sjp.JobName,sd.DepName,sc.CompanyName,su.* From Sys_Users su Inner Join Sys_Company sc On su.CompanyId = sc.Id Inner Join Sys_Department sd On su.DepId = sd.Id Inner Join Sys_JobPost sjp On su.JobPostId = sjp.Id {0}", sqlWhere); var _userList = await GetListBySqlWithNolockAsync(userSqlWhere); if (portType == 1) //web { List _userWebList = _mapper.Map>(_userList); if (_userList.Count != 0) { result.Code = 0; result.Msg = "成功!"; result.Data = _userWebList; } else { result.Code = -1; result.Msg = "暂无数据!"; } } else if (portType == 2) //Android { List _userDataList = _mapper.Map>(_userList); if (_userDataList.Count != 0) { result.Code = 0; result.Msg = "成功!"; result.Data = _userDataList; } else { result.Code = -1; result.Msg = "暂无数据!"; } } else if (portType == 3) //IOS { } else { result.Code = -1; result.Msg = "暂无数据!"; } return result; } } }