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.ErpBomPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpBomDO;
import org.apache.ibatis.annotations.Mapper;

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

    default PageResult<ErpBomDO> selectPage(ErpBomPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpBomDO>()
                .likeIfPresent(ErpBomDO::getFactoryNumber, reqVO.getFactoryNumber())
                .likeIfPresent(ErpBomDO::getUpMaterial, reqVO.getUpMaterial())
                .eqIfPresent(ErpBomDO::getUseItem, reqVO.getUseItem())
                .likeIfPresent(ErpBomDO::getMaterialDescription, reqVO.getMaterialDescription())
                .eqIfPresent(ErpBomDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(ErpBomDO::getUnit, reqVO.getUnit())
                .orderByDesc(ErpBomDO::getId));
    }
}