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.YwPeople; 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; /** * 运维人员表单 * * @author xp * @since 2024-03-04 */ @Data @Accessors(chain = true) @ApiModel(value = "YwPeople表单", description = "运维人员表单") public class YwPeopleForm extends AbsForm { @NotBlank(message = "运维人员编号不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("运维人员编号") private String ywPersonCode; @NotBlank(message = "运维人员姓名不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("运维人员姓名") private String ywPersonName; @NotBlank(message = "运维人员账号不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("运维人员账号") private String ywPersonAccount; @NotNull(message = "所属运维单位不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("所属运维单位") private Integer belongUnit; @ApiModelProperty("添加数据的方式:手动、导入") private String addWay; @NotBlank(message = "联系电话不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("联系电话") private String phone; public static YwPeople getEntityByForm(@NonNull YwPeopleForm form, YwPeople entity) { if(entity == null) { entity = new YwPeople(); } BeanUtils.copyProperties(form, entity); return entity; } }