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.

59 lines
1.6 KiB

2 years ago
2 years ago
  1. using AutoMapper.Internal.Mappers;
  2. using Shentun.Peis.MedicalPackageDetails;
  3. using Shentun.Peis.Models;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Volo.Abp;
  10. using Volo.Abp.Domain.Repositories;
  11. using Volo.Abp.Domain.Services;
  12. namespace Shentun.Peis.AsbitemDetails
  13. {
  14. public class AsbitemDetailManager : DomainService
  15. {
  16. private readonly IRepository<AsbitemDetail> _repository;
  17. public AsbitemDetailManager(
  18. IRepository<AsbitemDetail> repository
  19. )
  20. {
  21. this._repository = repository;
  22. }
  23. /// <summary>
  24. /// 创建
  25. /// </summary>
  26. /// <param name="entity"></param>
  27. /// <returns></returns>
  28. public AsbitemDetail CreateAsbitemAsync(AsbitemDetail entity)
  29. {
  30. DataHelper.CheckGuidIsDefaultValue(entity.AsbitemId, "组合项目编号");
  31. DataHelper.CheckGuidIsDefaultValue(entity.ItemId, "项目编号");
  32. return entity;
  33. }
  34. /// <summary>
  35. /// 删除组合项目明细
  36. /// </summary>
  37. /// <param name="AsbitemId">组合项目ID</param>
  38. /// <returns></returns>
  39. /// <exception cref="UserFriendlyException"></exception>
  40. public async Task CheckAndDeleteAsync(Guid AsbitemId)
  41. {
  42. var asbitemDetailList = await _repository.GetListAsync(m => m.AsbitemId == AsbitemId);
  43. if (asbitemDetailList.Any())
  44. {
  45. //删除组合项目明细
  46. await _repository.DeleteManyAsync(asbitemDetailList);
  47. }
  48. }
  49. }
  50. }