概述
List<id> rightEmpIds = new list<id>(); //id集合
String intentionStr='';
Integer noFollow_Day = 2 //
String activeStatusStr='';
String labelsStr='';
String customLabels = '';
String startDate='';//DateTime类型的字符串
String endDate='';//DateTime类型的字符串
String searchInfo = '';
//查询的字符串
String queryString = 'select id,Account__r.Name,Phone__c,Account__r.Address__c,Phase__c,CreatedDate,DecorationAddress__c,LastModifiedDate,HostEmployee__c'
+',Intention__c,Source__c,NoFollow_Day__c,ActiveStatus__c,Labels__c,Other_Labels__c,Renovation_District__c'
+',Employee__r.Wechat_User__r.vlink__User_ID__c,Lead__c,Area__c'
+' from Opportunity__c'
+' where Employee__c in :rightEmpIds'
+(Intention!='' ? (' And IntentionCode__c in '+('('+intentionStr+')')) : '')
+(NoFollow_Day!=0 ? (' And OppNoFollow_Day__c <= ' + Integer.valueOf(NoFollow_Day)) : '')
+(ActiveStatus!='' ? (' And ActiveStatus__c in '+('('+activeStatusStr+')')) : '')
+(Labels!='' ? (' And Labels__c includes '+('('+labelsStr+')') ): '')
+(customLabels!=null ? (' And Other_Labels__c like '+''%'+customLabels+'%'') : '')
+(startDate!=NULL ? (' And CreatedDate__c>='+startDate) : '')
+(endDate!=NULL ? (' And CreatedDate__c<='+endDate) : '')
+(Utils.isNull(searchInfo) ? '' : ' And('
+' Account__r.Name like '+''%'+searchInfo+'%''
+' OR Phone__c like '+''%'+searchInfo+'%''
+')')
+' Order by TaskPhaseCode__c ASC,createdDate desc'
+' limit 50000'
;
//查询
List<Opportunity__c> list_opps = Database.query(queryString);
最后
以上就是糊涂睫毛膏为你收集整理的Salesforce 中SOQL语句查询字符串拼接的全部内容,希望文章能够帮你解决Salesforce 中SOQL语句查询字符串拼接所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复