类 CustomFunction

java.lang.Object
net.sohelp.boot.demo.core.magic.script.CustomFunction
所有已实现的接口:
org.ssssssss.magicapi.core.config.MagicFunction

public class CustomFunction extends Object implements org.ssssssss.magicapi.core.config.MagicFunction
自定义函数 https://ssssssss.org/guide/custom/function.html
另请参阅:
  • MagicFunction
  • 构造器详细资料

    • CustomFunction

      public CustomFunction()
  • 方法详细资料

    • now

      @Function @Comment("\u53d6\u5f53\u524d\u65f6\u95f4") public static Date now()
      获取当前系统时间
      返回:
      当前日期时间对象
    • date_format

      @Function @Comment("\u65e5\u671f\u683c\u5f0f\u5316") public static String date_format(@Comment("\u76ee\u6807\u65e5\u671f") Date target)
      格式化日期时间为默认格式(yyyy-MM-dd HH:mm:ss)
      参数:
      target - 目标日期时间对象
      返回:
      格式化后的日期时间字符串,如果目标为null则返回null
    • date_format

      @Function @Comment("\u65e5\u671f\u683c\u5f0f\u5316") public static String date_format(@Comment("\u76ee\u6807\u65e5\u671f") Date target, @Comment("\u683c\u5f0f") String pattern)
      按指定格式格式化日期时间
      参数:
      target - 目标日期时间对象
      pattern - 日期时间格式模式
      返回:
      格式化后的日期时间字符串,如果目标为null则返回null
    • ifnull

      @Function @Comment("\u5224\u65ad\u503c\u662f\u5426\u4e3a\u7a7a") public static Object ifnull(@Comment("\u76ee\u6807\u503c") Object target, @Comment("\u4e3a\u7a7a\u7684\u503c") Object trueValue, @Comment("\u4e0d\u4e3a\u7a7a\u7684\u503c") Object falseValue)
      判断目标值是否为空并返回相应结果
      参数:
      target - 目标值
      trueValue - 目标值为空时返回的值
      falseValue - 目标值不为空时返回的值
      返回:
      如果目标值为空返回trueValue,否则返回falseValue