package com.hnct.business.domain.form; import com.hnct.common.group.Update; import com.hnct.common.group.Add; import com.hnct.system.domain.base.AbsForm; import com.hnct.business.domain.entity.Test; import org.springframework.beans.BeanUtils; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import org.springframework.lang.NonNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; /** * 定时任务调度表表单 * * @author xp * @since 2024-10-08 */ @Data @ApiModel(value = "Job表单", description = "定时任务调度表表单") public class TestForm extends AbsForm { @NotNull(message = "任务ID不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("任务ID") private Long jobId; @NotBlank(message = "任务名称不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("任务名称") private String jobName; @NotBlank(message = "任务组名不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("任务组名") private String jobGroup; @NotBlank(message = "调用目标字符串不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("调用目标字符串") private String invokeTarget; @NotBlank(message = "cron执行表达式不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("cron执行表达式") private String cronExpression; @NotBlank(message = "计划执行错误策略(1立即执行 2执行一次 3放弃执行)不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("计划执行错误策略(1立即执行 2执行一次 3放弃执行)") private String misfirePolicy; @NotBlank(message = "是否并发执行(0允许 1禁止)不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("是否并发执行(0允许 1禁止)") private String concurrent; @NotBlank(message = "状态(0正常 1暂停)不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("状态(0正常 1暂停)") private String status; @NotBlank(message = "创建者不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("创建者") private String createBy; @NotNull(message = "创建时间不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("创建时间") private Date createTime; @NotBlank(message = "更新者不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("更新者") private String updateBy; @NotNull(message = "更新时间不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("更新时间") private Date updateTime; @NotBlank(message = "备注信息不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("备注信息") private String remark; public static Test getEntityByForm(@NonNull TestForm form, Test entity) { if(entity == null) { entity = new Test(); } BeanUtils.copyProperties(form, entity); return entity; } }