From 71b93327e8f3fb3bffffc7c033c1f782e7b6ab32 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 22 五月 2023 17:37:16 +0800
Subject: [PATCH] test
---
force-app/main/default/classes/QLMAttachmentPreviewController.cls | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/force-app/main/default/classes/QLMAttachmentPreviewController.cls b/force-app/main/default/classes/QLMAttachmentPreviewController.cls
index 205f091..37962ac 100644
--- a/force-app/main/default/classes/QLMAttachmentPreviewController.cls
+++ b/force-app/main/default/classes/QLMAttachmentPreviewController.cls
@@ -4,7 +4,7 @@
// //闄勪欢鐨処d
public String attachId { get; private set; }
//鎵�鏈夐檮浠�
- public list<Attachment> attachMentList { get; private set; }
+ public list<ContentVersion> attachMentList { get; private set; }
//鎵�鏈夎秴杩�12Murl
public list<Over12MInfo> Over12MInfoList { get; set; }
@@ -20,8 +20,12 @@
try {
// return [SELECT Id, Body, ParentId FROM Attachment
// where Id = :parentId ].body.tostring();
- String Att = [SELECT Id, Body, ParentId FROM Attachment
- where Id = :attachId ].body.tostring();
+ // String Att = [SELECT Id, Body, ParentId FROM Attachment
+ // where Id = :attachId ].body.tostring();
+ // lwc鏀归��
+ String Att = [SELECT Id,Title,VersionData, ContentDocumentId
+ FROM ContentVersion
+ WHERE id = :attachId].VersionData.toString();
System.debug('------123456----' + Att);
return Att;
} catch (exception e) {
@@ -37,9 +41,21 @@
try {
//鍒ゆ柇url鏄惁鏈塱d
if (String.isNotBlank(this.parentId)) {
- this.attachMentList = [SELECT id, parentId, Name, Body, ContentType
- from Attachment where parentId = :parentId];
+ // this.attachMentList = [SELECT id, parentId, Name, Body, ContentType
+ // from Attachment where parentId = :parentId];
+ // lwc 淇敼
+ // 鏌ヨ ContentDocumentLink 瀵硅薄
+ List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+ FROM ContentDocumentLink
+ WHERE LinkedEntityId = :parentId];
+ // 閬嶅巻 ContentDocumentLink 瀵硅薄鍒楄〃
+ for (ContentDocumentLink cdl : cdlList) {
+ // 鏌ヨ ContentVersion 瀵硅薄
+ this.attachMentList = [SELECT Id,Title,VersionData, ContentDocumentId
+ FROM ContentVersion
+ WHERE ContentDocumentId = :cdl.ContentDocumentId];
+ }
attachmentInfo = new AttachmentInfo(attachMentList);
List<Tender_information__c> QLMattachMentList = [SELECT id, ProjectId__c, InfoType__c,
Overstep_12M_infofile__c,
@@ -66,12 +82,12 @@
}
public class AttachmentInfo {
- public list<Attachment> attachMentList { get; set; }
+ public list<ContentVersion> attachMentList { get; set; }
- public AttachmentInfo(list<Attachment> attachMentList) {
+ public AttachmentInfo(list<ContentVersion> attachMentList) {
this.attachMentList = attachMentList;
- for (Attachment tempatt : attachMentList) {
- tempatt.Name = String.escapeSingleQuotes(tempatt.Name);
+ for (ContentVersion tempatt : attachMentList) {
+ tempatt.Title = String.escapeSingleQuotes(tempatt.Title);
}
}
}
--
Gitblit v1.9.1