You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.8 KiB

2 years ago
  1. using EasyBL.WebApi.Message;
  2. using Entity.Sugar;
  3. using SqlSugar;
  4. using SqlSugar.Base;
  5. using System;
  6. namespace EasyBL.WEBAPP.SYS
  7. {
  8. public class SystemSetup_QryService : ServiceBase
  9. {
  10. #region 系統設定管理(分頁查詢)
  11. /// <summary>
  12. /// 系統設定管理(分頁查詢)
  13. /// </summary>
  14. /// <param name="i_crm"></param>
  15. /// <returns></returns>
  16. public ResponseMessage QueryPage(RequestMessage i_crm)
  17. {
  18. ResponseMessage rm = null;
  19. string sMsg = null;
  20. var db = SugarBase.GetIntance();
  21. try
  22. {
  23. do
  24. {
  25. var pml = new PageModel
  26. {
  27. PageIndex = _fetchInt(i_crm, @"pageIndex"),
  28. PageSize = _fetchInt(i_crm, @"pageSize")
  29. };
  30. var iPageCount = 0;
  31. var sSortField = _fetchString(i_crm, @"sortField");
  32. var sSortOrder = _fetchString(i_crm, @"sortOrder");
  33. var sSettingItem = _fetchString(i_crm, @"SettingItem");
  34. var sSettingDescription = _fetchString(i_crm, @"SettingDescription");
  35. var sSettingValue = _fetchString(i_crm, @"SettingValue");
  36. var sEffective = _fetchString(i_crm, @"Effective");
  37. var bExcel = _fetchBool(i_crm, @"Excel");
  38. pml.DataList = db.Queryable<OTB_SYS_SystemSetting>()
  39. .Where(x => x.OrgID == i_crm.ORIGID && x.SettingItem.Contains(sSettingItem) && x.SettingDescription.Contains(sSettingDescription) && x.SettingValue.Contains(sSettingValue) && sEffective.Contains(x.Effective))
  40. .OrderBy(sSortField, sSortOrder)
  41. .ToPageList(pml.PageIndex, bExcel ? 100000 : pml.PageSize, ref iPageCount);
  42. pml.Total = iPageCount;
  43. rm = new SuccessResponseMessage(null, i_crm);
  44. if (bExcel)
  45. {
  46. }
  47. else
  48. {
  49. rm.DATA.Add(BLWording.REL, pml);
  50. }
  51. } while (false);
  52. }
  53. catch (Exception ex)
  54. {
  55. sMsg = Util.GetLastExceptionMsg(ex);
  56. LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(SystemSetup_QryService), "", "QueryPage(系統設定管理(分頁查詢))", "", "", "");
  57. }
  58. finally
  59. {
  60. if (null != sMsg)
  61. {
  62. rm = new ErrorResponseMessage(sMsg, i_crm);
  63. }
  64. }
  65. return rm;
  66. }
  67. #endregion 系統設定管理(分頁查詢)
  68. }
  69. }