国产精品,日韩av,hdsexvideos中国少妇,xxxxx性bbbbb欧美熟妇,波多野结衣乳巨码无在线,国产成人亚洲精品乱码

APL函數(shù)代碼開放場景-范圍規(guī)則Java接口說明

2024-12-31 17:19:07 312 本站

1. 返回類型為List

package fx.custom.apl.example.scope_rule;
import com.fxiaoke.functions.FunctionContext;
import com.fxiaoke.functions.Fx;
import com.fxiaoke.functions.client.DebugHelper;
import com.fxiaoke.functions.model.*;
import com.fxiaoke.functions.template.IQueryListAction;
import com.fxiaoke.functions.tools.QueryOperator;
import com.fxiaoke.functions.utils.Lists;
import com.fxiaoke.functions.utils.Maps;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.fxiaoke.functions.Fx.log;
/**
* 使用集合(List)返回值類型,在新建對象數(shù)據(jù)時(shí),查找關(guān)聯(lián)字段可以選擇出其它對象中符合函數(shù)條件的數(shù)據(jù)
* 在新建對象數(shù)據(jù)時(shí),查找關(guān)聯(lián)字段可以選擇出其它對象中符合函數(shù)條件的數(shù)據(jù)
* 注:List返回類型函數(shù),用此方法返回的數(shù)據(jù)有上限500條在新建對象數(shù)據(jù)時(shí),查找關(guān)聯(lián)字段可以選擇出其它對象中符合函數(shù)條件的數(shù)據(jù)
*/
public class QueryListExample implements IQueryListAction {

   /**
    * 范圍規(guī)則函數(shù)(List)的運(yùn)行方法
    */
   @Override
   public List execute(FunctionContext context, Map<String, Object> args) {
       /* 在新建對象數(shù)據(jù)時(shí),查找關(guān)聯(lián)字段可以選擇出其它對象中符合函數(shù)條件的數(shù)據(jù)
        * 注:List返回類型函數(shù),用此方法返回的數(shù)據(jù)有上限500條
        */

       //獲取當(dāng)前操作對象數(shù)據(jù)的字段值
       String name = (String) context.getData().get("field_cG001__c");
       log.info(name);
       //根據(jù)條件查找數(shù)據(jù),本案例即查找另一對象中性別為男生的數(shù)據(jù)
       APIResult ret = Fx.object.find("object_M4WK7__c", //查詢對象apiname
               FQLAttribute.builder()
                       .columns(Lists.newArrayList("_id")) //返回?cái)?shù)據(jù)id
                       //匹配條件,關(guān)聯(lián)對象字段=當(dāng)前操作對象字段
                       .queryTemplate(QueryTemplate.AND(Maps.of("field_54cCg__c", QueryOperator.EQ(name))))
                       .build(),
               SelectAttribute.builder()
                       .build());
       if (ret.isError()) {
           log.info(ret.message());
       }

       //定義id List
       List objectIds = Lists.newArrayList();
       QueryResult result = (QueryResult) ret.getData();
       //遍歷查詢結(jié)果,將所有Id添加到objectIds中
       result.getDataList().forEach(item -> {
           Map map = (Map) item;
           objectIds.add(map.get("_id"));
       });
       //最后返回objectIds
       return objectIds;
   }

   public static void main(String[] args) throws IOException {
       //調(diào)試器
       DebugHelper helper = new DebugHelper();
       helper.init();
       Map<String, Object> param = new HashMap<>();
       //模擬調(diào)試的上下文,例如開發(fā)時(shí)想模擬一個(gè)客戶對象的上下文,以方便開發(fā)
       FunctionContext context = helper.context("object_zBB6O__c", "63fd7a30ffd89f00013c7be3");
       List execute = new QueryListExample().execute(context, param);
       log.info(execute);
   }}
       Copied!

#2. 返回類型為QueryTemplate

package fx.custom.apl.example.scope_rule;
import com.fxiaoke.functions.FunctionContext;
import com.fxiaoke.functions.Fx;
import com.fxiaoke.functions.client.DebugHelper;
import com.fxiaoke.functions.model.QueryTemplate;
import com.fxiaoke.functions.template.IQueryTemplateAction;
import com.fxiaoke.functions.tools.QueryOperator;
import com.fxiaoke.functions.utils.Maps;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* QueryTemplate范圍規(guī)則樣例
* 使用QueryTemplate限制查找關(guān)聯(lián)字段的選擇范圍
*/
public class QueryTemplateExample implements IQueryTemplateAction {
   /**
    * 范圍規(guī)則函數(shù)(QueryTemplate)的運(yùn)行方法
    */
   @Override
   public QueryTemplate execute(FunctionContext context, Map<String, Object> args) {

       //關(guān)聯(lián)的字段
       String type = (String) context.getData().get("field_cG001__c");
       String name = (String) context.getData().get("name");

       //構(gòu)造QueryTemplate --- //關(guān)聯(lián)對象的字段
       QueryTemplate template1 = QueryTemplate.AND(
               Maps.of("name", QueryOperator.EQ(name)),
               Maps.of("field_g7Zeh__c", QueryOperator.EQ(type))
       );

       QueryTemplate template2 = QueryTemplate.AND(
               Maps.of("owner", QueryOperator.EQ("100")),
               Maps.of("record_type", QueryOperator.EQ("default__c"))
       );

       //QueryTemplate使用OR條件需要單獨(dú)開通,請聯(lián)系銷售人員下訂單開通產(chǎn)品:【對象列表篩選支持或者】
       QueryTemplate template3 = QueryTemplate.AND(template1, template2);

       return template3;
   }


   public static void main(String[] args) throws IOException {
       //調(diào)試器
       DebugHelper helper = new DebugHelper();
       helper.init();
       Map<String, Object> param = new HashMap<>();
       //模擬調(diào)試的上下文,例如開發(fā)時(shí)想模擬一個(gè)客戶對象的上下文,以方便開發(fā)
       FunctionContext context = helper.context("object_zBB6O__c", "63fd7a30ffd89f00013c7be3");
       QueryTemplate execute = new QueryTemplateExample().execute(context, param);
       Fx.log.info(execute);
   }}
       Copied!

#3. 返回類型為RangeRule

package fx.custom.apl.example.scope_rule;
import com.fxiaoke.functions.FunctionContext;
import com.fxiaoke.functions.Fx;
import com.fxiaoke.functions.client.DebugHelper;
import com.fxiaoke.functions.model.QueryTemplate;
import com.fxiaoke.functions.model.RangeRule;
import com.fxiaoke.functions.template.IRangeRuleAction;
import com.fxiaoke.functions.tools.QueryOperator;
import com.fxiaoke.functions.utils.Maps;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* @type functions
* @returntype RangeRule
* @namespace scope_rule
* @targetmethod execute
*/
public class RangeRuleExample implements IRangeRuleAction {

   /**
    * 范圍規(guī)則函數(shù)(rangeRule)函數(shù)的運(yùn)行方法
    */
   @Override
   public RangeRule execute(FunctionContext context, Map<String, Object> args) {

       //關(guān)聯(lián)的字段
       String type = (String) context.getData().get("field_cG001__c");
       String name = (String) context.getData().get("name");

       //構(gòu)造QueryTemplate --- //關(guān)聯(lián)對象的字段
       QueryTemplate template1 = QueryTemplate.AND(
               Maps.of("name", QueryOperator.EQ(name)),
               Maps.of("field_g7Zeh__c", QueryOperator.EQ(type))
       );

       QueryTemplate template2 = QueryTemplate.AND(
               Maps.of("owner", QueryOperator.EQ("100")),
               Maps.of("record_type", QueryOperator.EQ("default__c"))
       );

       //QueryTemplate使用OR條件需要單獨(dú)開通,請聯(lián)系銷售人員下訂單開通產(chǎn)品:【對象列表篩選支持或者】
       QueryTemplate template3 = QueryTemplate.AND(template1, template2);

       //構(gòu)造RangeRule
       RangeRule rangeRule = RangeRule.builder()
               .queryTemplate(template3)
               .recordType("record_q6iJ7__c") // 查找關(guān)聯(lián)新建時(shí)默認(rèn)用該業(yè)務(wù)類型
               .build();
       return rangeRule;
   }


   public static void main(String[] args) throws IOException {
       //調(diào)試器
       DebugHelper helper = new DebugHelper();
       helper.init();
       Map<String, Object> param = new HashMap<>();
       //模擬調(diào)試的上下文,例如開發(fā)時(shí)想模擬一個(gè)客戶對象的上下文,以方便開發(fā)
       FunctionContext context = helper.context("object_zBB6O__c", "63fd7a30ffd89f00013c7be3");
       RangeRule execute = new RangeRuleExample().execute(context, param);
       Fx.log.info(execute);
   }}


部分內(nèi)容來源于互聯(lián)網(wǎng),如有侵權(quán),請聯(lián)系客服刪除處理。
在線咨詢 撥打電話