zhangqian
2023-05-24 ce5755dba4d5ea5e0544e77a7c66685779f36a9e
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
public with sharing class lexEquipmentRentalApply_FromSACtl {
    public lexEquipmentRentalApply_FromSACtl() {
 
    }
 
    //获取当前登录人的 id
    @AuraEnabled
    public static UserResult UserInfo_Owner() {
        UserResult result = new UserResult();
        ID myUserID = UserInfo.getUserId();
        try { 
            User tempUser =
                [select Id,isFormal_Stuff__c,FirstName,LastName from user where id = : myUserID ];
            result.id = tempUser.Id;
            result.isFormalStuff = tempUser.isFormal_Stuff__c;
            result.firstName = tempUser.FirstName;
            result.lastName = tempUser.LastName;
        } catch (exception e) {
            
            result.result = e.getMessage();
        }
        return result;
    }
 
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try {
            Statu_Achievements__c rep = [select Id,Name,Opp_Hospitalo__c,Opp_DeptClass__c,Opp_ClassName__c,Opportunity__c from Statu_Achievements__c where Id =: recordId];
            res.achievement = rep.Name;
            res.hospital = rep.Opp_Hospitalo__c;
            res.departmentClass = rep.Opp_DeptClass__c;
            res.oppClassName = rep.Opp_ClassName__c;
            res.opportunity = rep.Opportunity__c;
            return res;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    public class InitData{
        @AuraEnabled
        public String achievement;
        @AuraEnabled
        public String hospital;
        @AuraEnabled
        public String departmentClass;
        @AuraEnabled
        public String oppClassName;
        @AuraEnabled
        public String opportunity;
    }
 
    public class UserResult {
        @AuraEnabled
        public string result;
        public UserResult( ) {
            result = 'Success';
        }
        @AuraEnabled
        public string id;
        @AuraEnabled
        public Boolean isFormalStuff;
        @AuraEnabled
        public string firstName;
        @AuraEnabled
        public string lastName;
    }
}