public with sharing class CustomLink2AdvancePaymentController { @AuraEnabled public static InitData init(String recordId) { InitData res = new initData(); try { Account report = [SELECT Id,Name,FirstParagraph__c,MonthlyPayment__c FROM Account WHERE Id = :recordId]; res.RecordTypeId = Schema.SObjectType.Advance_Payment__c.getRecordTypeInfosByDeveloperName().get('FirstParagraphChange').getRecordTypeId(); res.Name = report.Name; res.FirstParagraph = report.FirstParagraph__c; res.MonthlyPayment = report.MonthlyPayment__c; List records = [SELECT id,Status__c FROM Advance_Payment__c WHERE Account__c =:recordId and RecordType.Id = :res.RecordTypeId and Status__c in ('草案中','已提交','批准中')]; res.records = records; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } public class InitData{ @AuraEnabled public String Name; @AuraEnabled public Boolean FirstParagraph; @AuraEnabled public Boolean MonthlyPayment; @AuraEnabled public List records; @AuraEnabled public String RecordTypeId; } }