Commit 902b0b5e47dba86bb18fcc5c70ba490f425ff16c

Authored by LesanOuO
1 parent 2ef7612f

feat: 条件节点添加包含和不包含操作符

yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
@@ -705,12 +705,21 @@ public class SimpleModelUtils { @@ -705,12 +705,21 @@ public class SimpleModelUtils {
705 } 705 }
706 // 构造规则表达式 706 // 构造规则表达式
707 List<String> list = convertList(item.getRules(), (rule) -> { 707 List<String> list = convertList(item.getRules(), (rule) -> {
  708 + // TODO @芋艿:官方文档中无convertByType方法,https://flowable.me/blog/2025/04/02/back-end-expressions/
708 String rightSide = NumberUtil.isNumber(rule.getRightSide()) ? rule.getRightSide() 709 String rightSide = NumberUtil.isNumber(rule.getRightSide()) ? rule.getRightSide()
709 : "\"" + rule.getRightSide() + "\""; // 如果非数值类型加引号 710 : "\"" + rule.getRightSide() + "\""; // 如果非数值类型加引号
710 - return String.format(" vars:getOrDefault(%s, null) %s var:convertByType(%s,%s) ",  
711 - rule.getLeftSide(), // 左侧:读取变量  
712 - rule.getOpCode(), // 中间:操作符,比较  
713 - rule.getLeftSide(), rightSide); // 右侧:转换变量,VariableConvertByTypeExpressionFunction 711 + return switch (rule.getOpCode()) {
  712 + case "contain" -> String.format(" var:contains(%s, %s) ",
  713 + rule.getLeftSide(),
  714 + rightSide);
  715 + case "!contain" -> String.format(" !var:contains(%s, %s) ",
  716 + rule.getLeftSide(),
  717 + rightSide);
  718 + default -> String.format(" var:getOrDefault(%s, null) %s %s ",
  719 + rule.getLeftSide(), // 左侧:读取变量
  720 + rule.getOpCode(), // 中间:操作符,比较
  721 + rightSide); // 右侧:取值变量
  722 + };
714 }); 723 });
715 // 构造条件组的表达式 724 // 构造条件组的表达式
716 Boolean and = item.getAnd(); 725 Boolean and = item.getAnd();