twysparks
2023-05-17 ba4651fb1416e263325b457c896dbbd83debe663
force-app/main/default/classes/otherButtonRepairController.cls
@@ -309,7 +309,7 @@
    //通过Is_Validity__c和Id字段查询Account的记录并返回
    @AuraEnabled
    public static List<Account> queryForFindInvalidLicense(Boolean isValidity,String dealerId){
    public static List<Account> queryForFindInvalidLicense(String dealerId){
        try {
            List<Account> accounts = [select Id,Is_Validity__c from Account where Is_Validity__c = false And Id = :dealerId];
            return accounts;
@@ -342,10 +342,9 @@
    //通过Id查询Repair__c中的Dealer__c,再根据Dealer__c查询Account中的记录并返回
    @AuraEnabled
    public static List<Account> queryForrecords3(String recordId){
    public static List<Account> queryForrecords3(String dealer){
        try {
            Repair__c repair = [select Repair__c.Dealer__c from Repair__c where Id =:recordId];
           List<Account> accounts = [select id, FirstParagraph__c from Account where name =:repair.Dealer__c];
           List<Account> accounts = [SELECT id, FirstParagraph__c from Account where name =:dealer];
           return accounts;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
@@ -355,6 +354,7 @@
    //更新Repair__c中的记录,将Maintenance_Contract__c和MaintenanceContractType__c字段更新为空,若捕获到异常则返回错误信息
    @AuraEnabled
    public static String updateForRepair1(String recordId){
        String res='';
        try {
            Repair__c repair = new Repair__c();
            repair.ID = recordId;
@@ -363,11 +363,9 @@
            update repair;
            return null;
        } catch (Exception e) {
            String eMessage = e.getMessage();
            Integer left = eMessage.indexOf(',') + 1;
            Integer right = eMessage.length();
            return eMessage.substring(left,right);
            res = e.getMessage();
        }
        return res;
    }
    //更新Repair__c中的记录,若捕获到异常则返回错误信息
@@ -408,6 +406,30 @@
        }
    }
     // 查找简档
     @AuraEnabled
     public static List<Profile> initSelectProfile(String profileId){
         List<Profile> res = new List<Profile>();
         try{
             res = [SELECT Id,name FROM Profile WHERE Id=: profileId ];
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
         return res;
     }
      // 查找UserName
      @AuraEnabled
      public static List<User> initUserName(String userId){
          List<User> res = new List<User>();
          try{
              res = [SELECT Id,name FROM User WHERE Id=: userId ];
          }catch(Exception e){
              System.debug(LoggingLevel.INFO, '*** e: ' + e);
          }
          return res;
      }
    public class InitData{
        @AuraEnabled
        public String detailedAddress;