package cn.estsh.i3plus.ext.mes.pojo.util;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * @DESCRIPTION:
 * @USER: wangjie
 * @DATE: 2022-11-24 16:04
 */
@Data
public class ConvertBeanExt {

    private String organizeCodeExt;

    private Integer isValidExt;

    private Integer isDeletedExt;

    private String createUserExt;

    private String createDatetimeExt;

    private String modifyUserExt;

    private String modifyDatetimeExt;

    private Integer systemSyncStatusExt;

    public ConvertBeanExt(BaseBean bean) {
        this.organizeCodeExt = bean.getOrganizeCode();
        this.isValidExt = bean.getIsValid();
        this.isDeletedExt = bean.getIsDeleted();
        this.createUserExt = bean.getCreateUser();
        this.createDatetimeExt = bean.getCreateDatetime();
        this.modifyUserExt = bean.getModifyUser();
        this.modifyDatetimeExt = bean.getModifyDatetime();
        this.systemSyncStatusExt = MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue();
    }

    public ConvertBeanExt extNoSync() {
        this.systemSyncStatusExt = MesExtEnumUtil.IF_SYNC_STATUS.ALREADY_SYNC.getValue();
        return this;
    }

    public void convertBean(Object o) {
        BeanUtils.copyProperties(this, o);
    }
}
