AttachementUtil.cs 696 B

123456789101112131415161718192021222324252627
  1. using Furion.JsonSerialization;
  2. using YBEE.EQM.Core;
  3. namespace YBEE.EQM.Application;
  4. /// <summary>
  5. /// 附件处理工具类
  6. /// </summary>
  7. public static class AttachementUtil
  8. {
  9. /// <summary>
  10. /// 获取附件列表
  11. /// </summary>
  12. public static List<AttachmentItem> GetList(string attachments)
  13. {
  14. return JSON.Deserialize<List<AttachmentItem>>(attachments);
  15. }
  16. /// <summary>
  17. /// 向附件中插入新记录
  18. /// </summary>
  19. public static string InsertInto(string attachments, AttachmentItem newItem)
  20. {
  21. var attachmentList = GetList(attachments);
  22. attachmentList.Add(newItem);
  23. return JSON.Serialize(attachmentList);
  24. }
  25. }