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 == null ? '' : tempUser.FirstName; result.lastName = tempUser.LastName == null ? '' : tempUser.LastName; } catch (exception e) { result.result = e.getMessage(); } return result; } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try { List repList = [select Id,Name,Opp_Hospitalo__c,Opp_Hospital_Id__c,Opp_DeptClass__c,Opp_DeptClass_Id__c,Opp_ClassName__c,Opp_Class_Id__c,Opportunity__c from Statu_Achievements__c where Id =: recordId]; if(repList.size() > 0){ Statu_Achievements__c rep = repList[0]; res.achievementId = rep.Id; res.achievement = rep.Name; res.hospital = rep.Opp_Hospital_Id__c; res.departmentClass = rep.Opp_DeptClass_Id__c == null ? '' : rep.Opp_DeptClass_Id__c; res.oppClassId = rep.Opp_Class_Id__c; res.oppClassName = rep.Opp_ClassName__c; res.opportunity = rep.Opportunity__c; return res; } return null; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } public class InitData{ @AuraEnabled public String achievementId; @AuraEnabled public String achievement; @AuraEnabled public String hospital; @AuraEnabled public String departmentClass; @AuraEnabled public String oppClassName; @AuraEnabled public String oppClassId; @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; } }