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.CheckTemplate;
|
|
import java.math.BigDecimal;
|
import java.time.LocalDateTime;
|
import java.util.List;
|
|
import jakarta.validation.constraints.NotEmpty;
|
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-06
|
*/
|
@Data
|
@Accessors(chain = true)
|
@ApiModel(value = "CheckTemplate表单", description = "考核模板表单")
|
public class CheckTemplateForm extends AbsForm {
|
|
@NotNull(message = "模板名称不能为空", groups = {Add.class, Update.class})
|
@ApiModelProperty("模板名称")
|
private String templateName;
|
|
@NotNull(message = "调整系数不能为空", groups = {Add.class, Update.class})
|
@ApiModelProperty("调整系数")
|
private BigDecimal adjustCoefficient;
|
|
@NotNull(message = "调整系数计算方式不能为空", groups = {Add.class, Update.class})
|
@ApiModelProperty("调整系数计算方式")
|
private String adjustWay;
|
|
@NotBlank(message = "状态不能为空", groups = {Add.class, Update.class})
|
@ApiModelProperty("状态")
|
private String status;
|
|
@NotEmpty(message = "考核规则不能为空")
|
@ApiModelProperty("考核规则")
|
private List<RuleItem> ruleList;
|
|
public static CheckTemplate getEntityByForm(@NonNull CheckTemplateForm form, CheckTemplate entity) {
|
if(entity == null) {
|
entity = new CheckTemplate();
|
}
|
BeanUtils.copyProperties(form, entity);
|
return entity;
|
}
|
|
public class RuleItem {
|
|
/**
|
* 规则
|
*/
|
private Integer ruleId;
|
|
/**
|
* 权重
|
*/
|
private BigDecimal weight;
|
|
public Integer getRuleId() {
|
return ruleId;
|
}
|
|
public void setRuleId(Integer ruleId) {
|
this.ruleId = ruleId;
|
}
|
|
public BigDecimal getWeight() {
|
return weight;
|
}
|
|
public void setWeight(BigDecimal weight) {
|
this.weight = weight;
|
}
|
}
|
|
}
|