TraceSupplementConfigService.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using Dapper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using XYY.Common.Standard;
  8. using XYY.Core.Standard.Data.Infrastructure;
  9. using XYY.Data.Model.Standard.Tracking;
  10. namespace XYY.Service.Standard.TrackingService
  11. {
  12. public interface ITraceSupplementConfigService
  13. {
  14. /// <summary>
  15. /// 添加配置
  16. /// </summary>
  17. /// <param name="supplementConfig"></param>
  18. /// <returns></returns>
  19. Task AddConfig(Logistics_Trace_SupplementConfig supplementConfig);
  20. /// <summary>
  21. /// 查找配置
  22. /// </summary>
  23. /// <param name="queryModel"></param>
  24. /// <returns></returns>
  25. Task<PageResult<Logistics_Trace_SupplementConfig>> QueryConfig(QueryModel queryModel);
  26. /// <summary>
  27. /// 获取所有配置
  28. /// </summary>
  29. /// <param name="queryModel"></param>
  30. /// <returns></returns>
  31. Task<List<Logistics_Trace_SupplementConfig>> GetAllConfig();
  32. /// <summary>
  33. /// 编辑配置
  34. /// </summary>
  35. /// <param name="supplementConfig"></param>
  36. /// <returns></returns>
  37. Task EditConfig(Logistics_Trace_SupplementConfig supplementConfig);
  38. /// <summary>
  39. /// 启用
  40. /// </summary>
  41. /// <param name="Ids"></param>
  42. /// <returns></returns>
  43. Task Enable(int[] Ids);
  44. /// <summary>
  45. /// 禁用
  46. /// </summary>
  47. /// <param name="Ids"></param>
  48. /// <returns></returns>
  49. Task Disable(int[] Ids);
  50. /// <summary>
  51. /// 移除
  52. /// </summary>
  53. /// <param name="Ids"></param>
  54. /// <returns></returns>
  55. Task Delete(int[] Ids);
  56. }
  57. public class TraceSupplementConfigService : ITraceSupplementConfigService
  58. {
  59. private readonly IUnitOfWork _unitOfWork;
  60. public TraceSupplementConfigService(IUnitOfWork unitOfWork)
  61. {
  62. _unitOfWork = unitOfWork;
  63. }
  64. public async Task AddConfig(Logistics_Trace_SupplementConfig supplementConfig)
  65. {
  66. await _unitOfWork.InsertAsync(supplementConfig);
  67. }
  68. public async Task Delete(int[] Ids)
  69. {
  70. await _unitOfWork.UpdateByConditionAsync<Logistics_Trace_SupplementConfig, bool>(x => x.Id.In(Ids), new
  71. {
  72. IsDelete = true
  73. });
  74. }
  75. public async Task Disable(int[] Ids)
  76. {
  77. await _unitOfWork.UpdateByConditionAsync<Logistics_Trace_SupplementConfig, bool>(x => x.Id.In(Ids), new
  78. {
  79. IsEnable = false
  80. });
  81. }
  82. public async Task EditConfig(Logistics_Trace_SupplementConfig supplementConfig)
  83. {
  84. await _unitOfWork.UpdateAsync(supplementConfig);
  85. }
  86. public async Task Enable(int[] Ids)
  87. {
  88. await _unitOfWork.UpdateByConditionAsync<Logistics_Trace_SupplementConfig, bool>(x => x.Id.In(Ids), new
  89. {
  90. IsEnable = true
  91. });
  92. }
  93. public async Task<List<Logistics_Trace_SupplementConfig>> GetAllConfig()
  94. {
  95. return (await _unitOfWork.QueryAsync<Logistics_Trace_SupplementConfig>()).ToList();
  96. }
  97. public async Task<PageResult<Logistics_Trace_SupplementConfig>> QueryConfig(QueryModel queryModel)
  98. {
  99. return await _unitOfWork.GetPagingList2Async<Logistics_Trace_SupplementConfig>(queryModel);
  100. }
  101. }
  102. }