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.

72 lines
2.5 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 OfficeTemplate_QryService : ServiceBase
  9. {
  10. #region Office模版管理(分頁查詢)
  11. /// <summary>
  12. /// Office模版管理(分頁查詢)
  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 sTemplID = _fetchString(i_crm, @"TemplID");
  34. var sTemplName = _fetchString(i_crm, @"TemplName");
  35. var bExcel = _fetchBool(i_crm, @"Excel");
  36. pml.DataList = db.Queryable<OTB_SYS_OfficeTemplate>()
  37. .Where(x => x.OrgID == i_crm.ORIGID && x.TemplID.Contains(sTemplID) && x.TemplName.Contains(sTemplName))
  38. .OrderBy(sSortField, sSortOrder)
  39. .ToPageList(pml.PageIndex, bExcel ? 100000 : pml.PageSize, ref iPageCount);
  40. pml.Total = iPageCount;
  41. rm = new SuccessResponseMessage(null, i_crm);
  42. if (bExcel)
  43. {
  44. }
  45. else
  46. {
  47. rm.DATA.Add(BLWording.REL, pml);
  48. }
  49. } while (false);
  50. }
  51. catch (Exception ex)
  52. {
  53. sMsg = Util.GetLastExceptionMsg(ex);
  54. LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(OfficeTemplate_QryService), "", "QueryPage(Office模版管理(分頁查詢))", "", "", "");
  55. }
  56. finally
  57. {
  58. if (null != sMsg)
  59. {
  60. rm = new ErrorResponseMessage(sMsg, i_crm);
  61. }
  62. }
  63. return rm;
  64. }
  65. #endregion Office模版管理(分頁查詢)
  66. }
  67. }