package com.moral.api.pojo.form.unitConversion; 
 | 
  
 | 
import com.moral.api.entity.UnitConversion; 
 | 
import lombok.Data; 
 | 
import org.springframework.util.ObjectUtils; 
 | 
  
 | 
/** 
 | 
 * @ClassName UnitConvertionInsertForm 
 | 
 * @Description TODO 
 | 
 * @Author 陈凯裕 
 | 
 * @Date 2021/5/11 16:18 
 | 
 * @Version TODO 
 | 
 **/ 
 | 
@Data 
 | 
public class UnitConversionInsertForm { 
 | 
    /* 
 | 
    * 原单位字典key 
 | 
    * */ 
 | 
    private String originalUnitKey; 
 | 
  
 | 
    /* 
 | 
    * 目标单位字典key 
 | 
    * */ 
 | 
    private String targetUnitKey; 
 | 
  
 | 
    /* 
 | 
    * 公式 
 | 
    * */ 
 | 
    private String formula; 
 | 
  
 | 
    /* 
 | 
    * 使用因子code,如果为null则为通用 
 | 
    * */ 
 | 
    private String sensorCode; 
 | 
  
 | 
    public boolean valid(){ 
 | 
        if( 
 | 
                ObjectUtils.isEmpty(originalUnitKey)|| 
 | 
                ObjectUtils.isEmpty(targetUnitKey)|| 
 | 
                ObjectUtils.isEmpty(formula) 
 | 
                ) 
 | 
            return false; 
 | 
        return true; 
 | 
    } 
 | 
  
 | 
    public UnitConversion formConvertEntity(){ 
 | 
        UnitConversion unitConversion = new UnitConversion(); 
 | 
        unitConversion.setOriginalUnitKey(originalUnitKey); 
 | 
        unitConversion.setTargetUnitKey(targetUnitKey); 
 | 
        unitConversion.setFormula(formula); 
 | 
        unitConversion.setSensorCode(sensorCode); 
 | 
        return unitConversion; 
 | 
    } 
 | 
  
 | 
} 
 |