package cn.estsh.i3plus.pojo.mdm.repository;

import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mdm.bean.base.BaseMdmBean;
import cn.estsh.i3plus.pojo.mdm.bean.busi.core.MdmGearCoreBusiExtd;
import cn.estsh.i3plus.pojo.mdm.bean.master.MdmGear;

import java.util.List;

/**
 * @Description : 主数据中心 HQL 包
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2020-05-20 15:23
 * @Modify:
 **/
public class MdmHqlPack {

    public static DdlPackBean getMdmPackBean(BaseMdmBean mdmBean) {
        DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(mdmBean);

        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), "isMdmPublished", ddlPackBean);
        return ddlPackBean;
    }

    public static DdlPackBean getMdmPackBean() {
        DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), "isMdmPublished", ddlPackBean);
        return ddlPackBean;
    }


    public static DdlPackBean packHqlIdList(List<Long> idList) {
        DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getInPackList(idList,"id",ddlPackBean);

        return ddlPackBean;
    }

    public static DdlPackBean packHqlMdmGear(MdmGear mdmGear) {
        DdlPackBean ddlPackBean = getMdmPackBean(mdmGear);

        DdlPreparedPack.getNumEqualPack(mdmGear.getId(),"id",ddlPackBean);
        DdlPreparedPack.getStringLikerPack(mdmGear.getName(),"name",ddlPackBean);
        DdlPreparedPack.timeBuilder(mdmGear.getModifyDatetime(),"modifyDatetime",ddlPackBean,false,true);

        return ddlPackBean;
    }

    public static DdlPackBean packHqlMdmGearCoreExtd(MdmGearCoreBusiExtd mdmGear) {
        DdlPackBean ddlPackBean = getMdmPackBean(mdmGear);

        DdlPreparedPack.getNumEqualPack(mdmGear.getId(),"id",ddlPackBean);
        DdlPreparedPack.getNumEqualPack(mdmGear.getMdmMasterId(),"mdmMasterId",ddlPackBean);
        DdlPreparedPack.timeBuilder(mdmGear.getModifyDatetime(),"modifyDatetime",ddlPackBean,false,true);

        return ddlPackBean;
    }

}
