💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 ``` /** * <b>方法描述:</b> SWITCH选择器 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-12-18 16:01:35 <br/> * * @param value * 入参|switch值|{@link java.lang.String} * @param case1 * 入参|分支1|{@link java.lang.String} * @param case2 * 入参|分支2|{@link java.lang.String} * @param case3 * 入参|分支3|{@link java.lang.String} * @param case4 * 入参|分支4|{@link java.lang.String} * @param case5 * 入参|分支5|{@link java.lang.String} * @param case6 * 入参|分支6|{@link java.lang.String} * @return 0 默认<br/> * 1 P1<br/> * 2 P2<br/> * 3 P3<br/> * 4 P4<br/> * 5 P5<br/> * 6 P6<br/> */ @Component(label = "SWITCH选择器", style = "选择型", type = "同步组件", comment = "默认0,最左端分支。从左到右,依次为:0,1,2,3...6", version = "1.0.0", deprecated = false, author = "admin", date = "2020-12-18 04:01:35") @InParams(param = {@Param(name = "value", comment = "switch值", type = java.lang.String.class), @Param(name = "case1", comment = "分支1", type = java.lang.String.class), @Param(name = "case2", comment = "分支2", type = java.lang.String.class), @Param(name = "case3", comment = "分支3", type = java.lang.String.class), @Param(name = "case4", comment = "分支4", type = java.lang.String.class), @Param(name = "case5", comment = "分支5", type = java.lang.String.class), @Param(name = "case6", comment = "分支6", type = java.lang.String.class)}) @Returns(returns = {@Return(id = "0", desp = "默认"), @Return(id = "1", desp = "P1"), @Return(id = "2", desp = "P2"), @Return(id = "3", desp = "P3"), @Return(id = "4", desp = "P4"), @Return(id = "5", desp = "P5"), @Return(id = "6", desp = "P6")}) @Order(value = 2) public static ResultBase P_switchCase(String value, String case1, String case2, String case3, String case4, String case5, String case6) { AppLog.info("SWITCH选择器,value={}", value); if (StringUtil.isEmpty(value)) return new ResultBase(0); if (value.equals(case1)) { return new ResultBase(1); } if (value.equals(case2)) { return new ResultBase(2); } if (value.equals(case3)) { return new ResultBase(3); } if (value.equals(case4)) { return new ResultBase(4); } if (value.equals(case5)) { return new ResultBase(5); } if (value.equals(case6)) { return new ResultBase(6); } return new ResultBase(0); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/c1/c0/c1c0ff84a36977fdb2e154c303a71707_1867x890.png) # 参数说明及示例 ## 入口参数 switch值:传入一个字符串类型的值,示例: `"1"` 分支1:传入一个字符串类型的值,示例: `"1"` 分支2:传入一个字符串类型的值:示例: `"2"` 分支3:传入一个字符串类型的值示例: `"3"` 分支4:传入一个字符串类型的值示例: `"4"` 分支5:传入一个字符串类型的值示例: `"5"` 分支6:传入一个字符串类型的值示例: `"6"`