1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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<Advance_Payment__c> 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) {
        }
        return res;
    }
    public class InitData{
        @AuraEnabled
        public String name;
        @AuraEnabled
        public Boolean firstParagraph;
        @AuraEnabled
        public Boolean monthlyPayment;
        @AuraEnabled
        public List<Advance_Payment__c> records;
        @AuraEnabled
        public String recordTypeId;
    }
}