package com.zt.plat.module.erp.dal.mysql.erp;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpBomDetailPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpBomDetailDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * ERP物料清单(BOM)明细 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ErpBomDetailMapper extends BaseMapperX<ErpBomDetailDO> {

    default PageResult<ErpBomDetailDO> selectPage(ErpBomDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpBomDetailDO>()
                .eqIfPresent(ErpBomDetailDO::getBomId, reqVO.getBomId())
                .eqIfPresent(ErpBomDetailDO::getErpBomId, reqVO.getErpBomId())
                .eqIfPresent(ErpBomDetailDO::getChildMaterialNumber, reqVO.getChildMaterialNumber())
                .eqIfPresent(ErpBomDetailDO::getChildMaterialDescription, reqVO.getChildMaterialDescription())
                .eqIfPresent(ErpBomDetailDO::getCategory, reqVO.getCategory())
                .eqIfPresent(ErpBomDetailDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(ErpBomDetailDO::getUnit, reqVO.getUnit())
                .eqIfPresent(ErpBomDetailDO::getIdentificationType, reqVO.getIdentificationType())
                .orderByDesc(ErpBomDetailDO::getId));
    }

}