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

/**
 * ERP工艺路线 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ErpProcessMapper extends BaseMapperX<ErpProcessDO> {

    default PageResult<ErpProcessDO> selectPage(ErpProcessPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpProcessDO>()
                .likeIfPresent(ErpProcessDO::getFactoryNumber, reqVO.getFactoryNumber())
                .likeIfPresent(ErpProcessDO::getMaterialNumber, reqVO.getMaterialNumber())
                .likeIfPresent(ErpProcessDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(ErpProcessDO::getBlineGroup, reqVO.getBlineGroup())
                .eqIfPresent(ErpProcessDO::getGroupCount, reqVO.getGroupCount())
                .likeIfPresent(ErpProcessDO::getBlineDescription, reqVO.getBlineDescription())
                .eqIfPresent(ErpProcessDO::getUom, reqVO.getUom())
                .eqIfPresent(ErpProcessDO::getUseDescription, reqVO.getUseDescription())
                .eqIfPresent(ErpProcessDO::getStatus, reqVO.getStatus())
                .orderByDesc(ErpProcessDO::getId));
    }

}