package com.lantone.entity.cdss.wrapper;

import com.lantone.entity.cdss.MappingConfig;
import com.lantone.common.util.StringUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @Description:
 * @Author:zhaops
 * @time: 2021/6/10 19:27
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MappingConfigWrapper extends MappingConfig {
    private String uniqueName;
    private Integer status;
    private String form;
    private Integer formStatus;
    private String code;
    /**
     * 国药准字
     */
    private String approval;

   /* @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MappingConfigWrapper mappingConfigWrapper = (MappingConfigWrapper) o;
        return super.equals(o)
                && Objects.equals(uniqueName, mappingConfigWrapper.uniqueName)
                && Objects.equals(form, mappingConfigWrapper.form)
                && Objects.equals(code, mappingConfigWrapper.code);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uniqueName, form, code) + super.hashCode();
    }*/

    public static boolean nonNull(MappingConfigWrapper o) {
        return !(o == null
                || (StringUtil.isBlank(o.uniqueName)
                && o.status == null
                && StringUtil.isBlank(o.form)
                && o.formStatus == null
                && StringUtil.isBlank(o.code)
                && StringUtil.isBlank(o.approval)))
                || MappingConfig.nonNull(o);
    }
}