From fbd4bea7bd57b4d4a33cb9ed0ebc15d9bf6551c0 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期三, 12 七月 2023 17:54:54 +0800
Subject: [PATCH] 近日更新按钮,页面以及apex类

---
 force-app/main/default/classes/AssetModifyBelongsController.cls |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/force-app/main/default/classes/AssetModifyBelongsController.cls b/force-app/main/default/classes/AssetModifyBelongsController.cls
index c9ca4ce..8e105d0 100644
--- a/force-app/main/default/classes/AssetModifyBelongsController.cls
+++ b/force-app/main/default/classes/AssetModifyBelongsController.cls
@@ -50,7 +50,7 @@
     public Boolean isShow { get; set; }
     public List<Attachment> attachments { get; set; }
     //CHAN-BC6BV2 XHL AddEnd 20190522
-
+	public List<ContentDocument> contents { get; set; }
     //鍒嗛〉鍔熻兘
     public Integer pageLimit {get; set;}
     public String soql {get; set;}
@@ -68,6 +68,14 @@
         pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
 
         attachments = new List<Attachment>();
+        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+                                                   FROM ContentDocumentLink
+                                                   WHERE LinkedEntityId = :Id];
+        List<ID> fileIDs = new List<ID>();
+        for (ContentDocumentLink docLink : cdlList) {
+            fileIDs.add(docLink.ContentDocumentId);
+        }
+        contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
     }
 
     public boolean getcheckUser() {
@@ -170,7 +178,8 @@
         Map<String, AssetModifyBelongsChangeDetailInfo> MidMap = new Map<String, AssetModifyBelongsChangeDetailInfo>();
         List<Asset> asListed = new List<Asset>();
         soql = this.makeSoql1(text1, val1);
-        asListed = Database.query(soql);
+        System.debug('soql:'+soql);
+		asListed = Database.query(soql);
         asListed = noSubmittedList(asListed);
         for (AssetModifyBelongsChangeDetailInfo bss : assetModifyBelongsChangeDetailRecordsview) {
             if (bss.check == true) {
@@ -260,7 +269,17 @@
         if (String.isNotBlank(val1)) {
             val1 = val1.trim();
         }
-        String soql = 'select Id,name,SerialNumber,Asset_situation__c,Order_No__c,Account.Name,Status,Installation_Site__c,CurrentContract__c from Asset where AccountId = \'' + RawAccountId + '\'';
+        String soql='';
+        System.debug(RawAccountId);
+        RawAccountId='';
+        if(String.isBlank(RawAccountId)){
+            soql = 'select Id,name,SerialNumber,Asset_situation__c,Order_No__c,Account.Name,Status,Installation_Site__c,CurrentContract__c from Asset where AccountId = \'\'';
+            System.debug('id is null');
+        }
+        else {
+            soql = 'select Id,name,SerialNumber,Asset_situation__c,Order_No__c,Account.Name,Status,Installation_Site__c,CurrentContract__c from Asset where AccountId = \'' + RawAccountId + '\'';
+            System.debug('id is not null');
+        }
         if (!String.isBlank(text1)) {
             if (text1 == 'Order_No__c' && checkexact) {
                 soql += ' AND (' + text1 + ' = \'' + String.escapeSingleQuotes(val1) + '\' )';
@@ -325,6 +344,18 @@
     //璺宠浆鍒颁笂浼犻檮浠堕〉闈�
     public PageReference uploadingAttachment() {
         PageReference ref = new Pagereference('/p/attach/NoteAttach?pid=' + Id + '&retURL=%2Fapex/AssetModifyBelongs?Id=' + Id);
+        
+        
+        //PageReference ref = new Pagereference('/lightning/n/Excel?objectApiName&context=RECORD_DETAIL&backgroundContext=%2Flightning%2Fr%2FAssetModifyBelongsChange__c%2F'+Id+'%2Fedit%3F0.source%3DalohaHeader&0.source='+Id+'&0.recordId='+Id+'');
+        
+        ref.setRedirect(true);
+        return ref;
+    }
+    //璺宠浆鍒颁笂浼犻檮浠堕〉闈紙lightning锛�
+    public PageReference uploadingAttachmentLightning() {
+        //PageReference ref = new Pagereference('/p/attach/NoteAttach?pid=' + Id + '&retURL=%2Fapex/AssetModifyBelongs?Id=' + Id);
+        PageReference ref = new Pagereference('/lightning/n/lightning?backgroundContext=%2Flightning%2Fr%2FAssetModifyBelongsChange__c%2F'+Id+'%2Fedit%3Fcount%3D1&0.recordId='+Id+'');
+        
         ref.setRedirect(true);
         return ref;
     }

--
Gitblit v1.9.1