CgglScyjRepository.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using QM.KJGH.CGGL.IRepository;
  2. using QM.KJGH.CGGL.Model.Cggl;
  3. using QM.KJGH.Model.KJGH;
  4. using QM.OrmSqlSugar;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Threading.Tasks;
  8. using WS.AutoMapper;
  9. namespace QM.KJGH.CGGL.Repository
  10. {
  11. /// <summary>
  12. ///
  13. /// </summary>
  14. public class CgglScyjRepository : SqlSugarRepository<CgglScyj>, ICgglScyjRepository
  15. {
  16. private ICgglScxmRepository _ICgglScxmRepository;
  17. public CgglScyjRepository(ICgglScxmRepository ICgglScxmRepository)
  18. {
  19. _ICgglScxmRepository = ICgglScxmRepository;
  20. }
  21. /// <summary>
  22. /// 添加审查意见
  23. /// </summary>
  24. /// <returns></returns>
  25. public async Task<bool> Add(CgglScyjDto dto, string currUser)
  26. {
  27. var model = dto.MapTo<CgglScyj>();
  28. model.BSM = Guid.NewGuid().ToString("N");
  29. model.SCYH = currUser;
  30. model.SCSJ = DateTime.Now;
  31. var result = await InsertAsync(model);
  32. var db = DbClient();
  33. if (dto.STATUS == 1)
  34. {
  35. await _ICgglScxmRepository.AuditCompleted(dto.CG_BSM, "退回");
  36. }
  37. return result == null ? false : true;
  38. }
  39. /// <summary>
  40. /// 根据成果编号查询审查列表
  41. /// </summary>
  42. /// <param name="cgbsm"></param>
  43. /// <returns></returns>
  44. public async Task<List<CgglScyjView>> QueryList(string cgbsm)
  45. {
  46. var result = (await GetListAsync(u => u.CG_BSM == cgbsm)).MapTo<CgglScyj, CgglScyjView>();
  47. return result;
  48. }
  49. }
  50. }