/**
 * *
    ODescription:
    GAuthor: sun xia
    @Date: 2023-07-11 15:31:56
    GIastEditors: sun xia
    @IastEditTime: 2023-07-17 15:31:56
 * */
public with sharing class LexRentalApplyFaultController {
    @AuraEnabled
    public static Rental_Apply_Fault__c init(String recordId){
        try {
            List<Rental_Apply_Fault__c> rafList = [Select Id, status__c from Rental_Apply_Fault__c where Id = :recordId];
            if(rafList.size()>0){
                return rafList[0];
            }
        }
        catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e.getMessage()+e.getLineNumber(): ' + e.getMessage()+e.getLineNumber());
            
        }
        return null;
    }

    @AuraEnabled
    public static String updateRentalApplyFaultStatus(String recordId, String updateStatus){
        Savepoint sp = Database.setSavepoint();
        try {
            Rental_Apply_Fault__c updateRaf = new Rental_Apply_Fault__c();
            updateRaf.Id = recordId;
            updateRaf.status__c = updateStatus;
            Update updateRaf;
            return 'SUCCESS';
        }
        catch (Exception e) {
            Database.rollback(sp);
            System.debug(LoggingLevel.INFO, '*** e.getMessage()+e.getLineNumber(): ' + e.getMessage()+e.getLineNumber());
            return e.getMessage();
        }
    }
}