张宇恒
2022-04-28 ddf52e1dd6e4041756854ee3ea914d568e98922e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public with sharing class AdvanceOpportunityController {
    public AdvanceOpportunityController(ApexPages.StandardController stdController) {
        AdOpportunity = new Advance_Opportunity__c();
    }
    public Advance_Opportunity__c AdOpportunity{get; set;}
    public void init(){
        String aoId = ApexPages.currentPage().getParameters().get('id');
        List<Advance_Opportunity__c> aoList = [SELECT Id,MarketAdvance__c,AddOpportunity__c,BigContract__c,GradePro__c,AddPrice__c,Opportunity__c FROM Advance_Opportunity__c WHERE Opportunity__c = :aoId];
        if (aoList.size() == 0) {
            
        } else{
            AdOpportunity = aoList[0];
        }
    }
    public void save(){
        if (String.isBlank(AdOpportunity.Opportunity__c)) {
            AdOpportunity.Opportunity__c = ApexPages.currentPage().getParameters().get('id');
        }
        // AdOpportunity.Name = 'ceshi';
        upsert AdOpportunity;
    }
}