package com.cf.imes.module.manage.dal.mysql.remainplaten;

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.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO;
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 生产单余料板表 order_remain_plate_{N} Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {

    default PageResult<RemainPlateDO> selectPage(RemainPlatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RemainPlateDO>()
                .eqIfPresent(RemainPlateDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId())
                .eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
                .likeIfPresent(RemainPlateDO::getName, reqVO.getName())
                .eqIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
                .eqIfPresent(RemainPlateDO::getColor, reqVO.getColor())
                .eqIfPresent(RemainPlateDO::getWidth, reqVO.getWidth())
                .eqIfPresent(RemainPlateDO::getLength, reqVO.getLength())
                .eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
                .eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
                .eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle())
                .eqIfPresent(RemainPlateDO::getStore, reqVO.getStore())
                .eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
                .eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(RemainPlateDO::getOutline, reqVO.getOutline())
                .betweenIfPresent(RemainPlateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RemainPlateDO::getId));
    }

}