package com.cf.imes.module.executor.dal.mysql.orderParts;

import java.util.*;

import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import org.apache.ibatis.annotations.Mapper;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;

/**
 * 生产单配件表 order_parts_{N} Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {

    default PageResult<OrderPartsDO> selectPage(OrderPartsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderPartsDO>()
                .eqIfPresent(OrderPartsDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderPartsDO::getGoodsId, reqVO.getGoodsId())
                .likeIfPresent(OrderPartsDO::getName, reqVO.getName())
                .eqIfPresent(OrderPartsDO::getMaterial, reqVO.getMaterial())
                .eqIfPresent(OrderPartsDO::getType, reqVO.getType())
                .eqIfPresent(OrderPartsDO::getModel, reqVO.getModel())
                .eqIfPresent(OrderPartsDO::getSpec, reqVO.getSpec())
                .eqIfPresent(OrderPartsDO::getBrand, reqVO.getBrand())
                .eqIfPresent(OrderPartsDO::getFactory, reqVO.getFactory())
                .eqIfPresent(OrderPartsDO::getUnit, reqVO.getUnit())
                .eqIfPresent(OrderPartsDO::getPrice, reqVO.getPrice())
                .eqIfPresent(OrderPartsDO::getIsComposite, reqVO.getIsComposite())
                .eqIfPresent(OrderPartsDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OrderPartsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderPartsDO::getId));
    }

}