package com.ycl.platform.domain.form; import com.ycl.system.domain.group.Update; import com.ycl.system.domain.group.Add; import com.ycl.platform.base.AbsForm; import com.ycl.platform.domain.entity.YwPoint; import org.springframework.beans.BeanUtils; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import org.springframework.lang.NonNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; import java.time.LocalDateTime; /** * 运维点位表单 * * @author xp * @since 2024-03-05 */ @Data @Accessors(chain = true) @ApiModel(value = "YwPoint表单", description = "运维点位表单") public class YwPointForm extends AbsForm { @NotBlank(message = "点位名称不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("点位名称") private String pointName; @NotNull(message = "点位开始时间不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("点位开始时间") private LocalDateTime startTime; @NotNull(message = "点位结束时间不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("点位结束时间") private LocalDateTime endTime; @NotNull(message = "运维单位不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("运维单位") private Integer unitId; // @NotBlank(message = "运维状态不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("运维状态") private String status; private String pointDetail; // @NotBlank(message = "备注不能为空", groups = {Add.class, Update.class}) // @ApiModelProperty("备注") // private String remark; public static YwPoint getEntityByForm(@NonNull YwPointForm form, YwPoint entity) { if(entity == null) { entity = new YwPoint(); } BeanUtils.copyProperties(form, entity); return entity; } }