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/eSignFormAttachmentController.cls | 41 +++++++++++++++++++++++++++++------------
1 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/force-app/main/default/classes/eSignFormAttachmentController.cls b/force-app/main/default/classes/eSignFormAttachmentController.cls
index 8d89cc5..c6b6093 100644
--- a/force-app/main/default/classes/eSignFormAttachmentController.cls
+++ b/force-app/main/default/classes/eSignFormAttachmentController.cls
@@ -24,19 +24,36 @@
}
public void getAccessory(){
- String soql = 'SELECT Name,id,parentId,ContentType from Attachment where parentId = :parentId order by createddate desc';
- List<Attachment> acc = Database.query(soql);
- Map<String,String> identifierMap = new Map<String,String>();
+ // parentId = 'a2K0l000000wyICEAY';
+
+ //lwc鏀归��
+ List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+ FROM ContentDocumentLink
+ WHERE LinkedEntityId = :parentId];
+ List<ID> fileIDs = new List<ID>();
+ for (ContentDocumentLink docLink : cdlList) {
+ fileIDs.add(docLink.ContentDocumentId);
+ }
+ List<ContentVersion> acc = [SELECT Id,Title,VersionData, ContentDocumentId,FileType
+ FROM ContentVersion WHERE ContentDocumentId IN : fileIDs];
+ Map<ID, String> identifierMap = new Map<ID, String>();
+ // for (ContentVersion docLink : acc) {
+ // identifierMap.put(docLink.ContentDocumentId, docLink.Title+docLink.FileType);
+ // }
+
+ // String soql = 'SELECT Name,id,parentId,ContentType from Attachment where parentId = :parentId order by createddate desc';
+ // List<Attachment> acc = Database.query(soql);
+ //Map<String,String> identifierMap = new Map<String,String>();
if(acc != null && acc.size() > 0){
for(Integer i = 0;i<acc.size();i++){
- if(acc[i].Name.substring(0,1)=='A'){
- acc[i].ContentType = '缁忛攢鍟�';
- identifierMap.put(acc[i].ContentType,acc[i].ContentType);
- }else if(acc[i].Name.substring(0,1)=='H'){
- acc[i].ContentType = '鍖婚櫌';
- identifierMap.put(acc[i].ContentType,acc[i].ContentType);
+ if(acc[i].Title.substring(0,1)=='A'){
+ acc[i].Description = '缁忛攢鍟�';
+ identifierMap.put(acc[i].Description,acc[i].Description);
+ }else if(acc[i].Title.substring(0,1)=='H'){
+ acc[i].Description = '鍖婚櫌';
+ identifierMap.put(acc[i].Description,acc[i].Description);
}else{
- acc[i].ContentType = '';
+ acc[i].Description = '';
}
acccData.add(new AccessoryData(acc[i]));
}
@@ -56,7 +73,7 @@
* 涓轰簡鏂逛究鍓嶇table鑾峰彇鍊�
*/
class AccessoryData {
- public Attachment accessory { get; set; }
+ public ContentVersion accessory { get; set; }
public Boolean canEdit { get; private set; }
public Boolean hasError { get; private set; }
public Boolean hasFieldError { get; private set; }
@@ -66,7 +83,7 @@
//澶嶉�夋id鍊�
public String chk { get;set; }
- public AccessoryData(Attachment record) {
+ public AccessoryData(ContentVersion record) {
accessory = record;
canEdit = true;
hasError = false;
--
Gitblit v1.9.1