新增自定义数据校验
This commit is contained in:
@ -6,6 +6,7 @@ import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -125,7 +126,7 @@ public class SysJobController extends BaseController
|
||||
@RequiresPermissions("monitor:job:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(SysJob job) throws SchedulerException, TaskException
|
||||
public AjaxResult addSave(@Validated SysJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
@ -147,7 +148,7 @@ public class SysJobController extends BaseController
|
||||
@RequiresPermissions("monitor:job:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(SysJob job) throws SchedulerException, TaskException
|
||||
public AjaxResult editSave(@Validated SysJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.ruoyi.quartz.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.validation.constraints.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@ -61,6 +62,8 @@ public class SysJob extends BaseEntity implements Serializable
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "任务名称不能为空")
|
||||
@Size(min = 0, max = 64, message = "任务名称不能超过64个字符")
|
||||
public String getJobName()
|
||||
{
|
||||
return jobName;
|
||||
@ -81,6 +84,8 @@ public class SysJob extends BaseEntity implements Serializable
|
||||
this.jobGroup = jobGroup;
|
||||
}
|
||||
|
||||
@NotBlank(message = "调用目标字符串不能为空")
|
||||
@Size(min = 0, max = 1000, message = "调用目标字符串长度不能超过500个字符")
|
||||
public String getInvokeTarget()
|
||||
{
|
||||
return invokeTarget;
|
||||
@ -91,6 +96,8 @@ public class SysJob extends BaseEntity implements Serializable
|
||||
this.invokeTarget = invokeTarget;
|
||||
}
|
||||
|
||||
@NotBlank(message = "Cron执行表达式不能为空")
|
||||
@Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符")
|
||||
public String getCronExpression()
|
||||
{
|
||||
return cronExpression;
|
||||
|
Reference in New Issue
Block a user