@ScriptAssert(lang="javascript",script="com.xxx.entity.dto.xxxDTO.check(_this.beginTime,_this.endTime)",groups=CHECK.class,message = "invalid time range")
public class xxxDTO { private Long beginTime; private Long endTime;
public interface CHECK {}
public static boolean check(Long start ,Long end ) { if (start >= end) { return false; } else{ return true; } }
使用:
@GetMapping() public void getxxx(@Validated(CHECK.class) xxxDTO dto) {
}