足力健后端,使用.netcore版本,合并1个项目使用

Sys_UserAccountRepository.cs 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Common;
  2. using Microsoft.Extensions.Logging;
  3. using System;
  4. using System.IRepositories;
  5. using System.Model;
  6. using System.Threading.Tasks;
  7. using SqlSugar;
  8. using System.Collections.Generic;
  9. namespace System.Repositories
  10. {
  11. public class Sys_UserAccountRepository : BaseRepository<T_Sys_UserAccount>, ISys_UserAccountRepository
  12. {
  13. public async Task<PageData<V_UserAccount>> GetListViewByPage(List<IConditionalModel> conModels, MyPageModel pagemodel, string orderby)
  14. {
  15. var userlist=await Db.SqlQueryable<V_UserAccount>("select * from T_Sys_UserAccount").Where(conModels).OrderBy(orderby).ToPageListAsync(pagemodel.PageIndex, pagemodel.PageSize, pagemodel.PageCount);
  16. var depts= await Db.SqlQueryable<V_UserAccount>("select * from T_Sys_UserAccount").Where(conModels).OrderBy(u => u.F_CreateOn, OrderByType.Desc).Select(n => n.F_DeptId).ToListAsync();
  17. var deptlist = await Db.Queryable<T_Sys_Department>().With(SqlWith.NoLock).Where(c => c.F_State==(int)EnumDelState.Enabled && depts.Contains(c.F_DeptId)).ToListAsync();
  18. var rolelist= await Db.Queryable<T_Sys_RoleInfo>().With(SqlWith.NoLock).Where(c => c.F_State == (int)EnumDelState.Enabled).ToListAsync();
  19. var seatlist= await Db.Queryable<T_Sys_SeatGroup>().With(SqlWith.NoLock).Where(c => c.F_State == (int)EnumDelState.Enabled).ToListAsync();
  20. var deptteamlist=await Db.Queryable<T_Sys_DeptTeam>().With(SqlWith.NoLock).Where(c => c.F_State == (int)EnumDelState.Enabled).ToListAsync();
  21. var positionlist= await Db.Queryable<T_Sys_Position>().With(SqlWith.NoLock).Where(c => c.F_State == (int)EnumDelState.Enabled).ToListAsync();
  22. var list = new List<V_UserAccount>();
  23. foreach (var item in userlist)
  24. {
  25. var newmodel = item;
  26. var deptmodel = deptlist.Find(a => a.F_DeptId == item.F_DeptId);
  27. if (deptmodel != null)
  28. newmodel.F_Dept = deptmodel.F_DeptName;
  29. var rolemodel = rolelist.Find(a => a.F_RoleId == item.F_RoleId);
  30. if (rolemodel != null)
  31. newmodel.F_Role = rolemodel.F_RoleName;
  32. var seatmodel = seatlist.Find(a => a.F_ZXZID == item.F_SeartGroupID);
  33. if (seatmodel != null)
  34. newmodel.F_SeartGroup = seatmodel.F_ZXZName;
  35. var deptteammodel = deptteamlist.Find(a => a.F_Id == item.F_DeptTeamId);
  36. if (deptteammodel != null)
  37. newmodel.F_DeptTeam = deptteammodel.F_Name;
  38. var positionmodel = positionlist.Find(a => a.F_Id == item.F_DutyId);
  39. if (positionmodel != null)
  40. newmodel.F_Duty = positionmodel.F_Name;
  41. list.Add(newmodel);
  42. }
  43. PageData<V_UserAccount> pd = new PageData<V_UserAccount>();
  44. pd.Rows = list;
  45. pd.Totals = pagemodel.PageCount;
  46. return pd;// CurrentDb.GetPageList(conModels, pagemodel);
  47. }
  48. }
  49. }