You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
815 B
27 lines
815 B
package com.dsideal.custom;
|
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.ssssssss.magicapi.core.config.MagicFunction;
|
|
import org.ssssssss.script.annotation.Comment;
|
|
import org.ssssssss.script.annotation.Function;
|
|
import org.ssssssss.script.functions.DateExtension;
|
|
|
|
import java.util.Date;
|
|
|
|
@Component //注入到Spring容器中
|
|
public class customFunction implements MagicFunction {
|
|
|
|
@Function
|
|
@Comment("自定义函数:无参有返回值")
|
|
public static Date customNow() {
|
|
return new Date();
|
|
}
|
|
|
|
@Function
|
|
@Comment("自定义函数:有参有返回值")
|
|
public static String customDateFormat(@Comment("目标日期") Date target) {
|
|
return target == null ? null : DateExtension.format(target, "yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
}
|