package com.zt.plat.module.base.dal.dao.processinginfomationoperation;

import java.util.*;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.processinginfomationoperation.ProcessingInfomationOperationDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.processinginfomationoperation.vo.*;

/**
 * 工艺工序 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface ProcessingInfomationOperationMapper extends BaseMapperX<ProcessingInfomationOperationDO> {

    default PageResult<ProcessingInfomationOperationDO> selectPage(ProcessingInfomationOperationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProcessingInfomationOperationDO>()
                .eqIfPresent(ProcessingInfomationOperationDO::getPreviousOperationId, reqVO.getPreviousOperationId())
                .eqIfPresent(ProcessingInfomationOperationDO::getNextOperationId, reqVO.getNextOperationId())
                .eqIfPresent(ProcessingInfomationOperationDO::getProcessingId, reqVO.getProcessingId())
                .eqIfPresent(ProcessingInfomationOperationDO::getOperationId, reqVO.getOperationId())
                .eqIfPresent(ProcessingInfomationOperationDO::getIsKey, reqVO.getIsKey())
                .eqIfPresent(ProcessingInfomationOperationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProcessingInfomationOperationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProcessingInfomationOperationDO::getId));
    }

    default List<ProcessingInfomationOperationDO> selectList(ProcessingInfomationOperationPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ProcessingInfomationOperationDO>()
                .eqIfPresent(ProcessingInfomationOperationDO::getPreviousOperationId, reqVO.getPreviousOperationId())
                .eqIfPresent(ProcessingInfomationOperationDO::getNextOperationId, reqVO.getNextOperationId())
                .eqIfPresent(ProcessingInfomationOperationDO::getProcessingId, reqVO.getProcessingId())
                .eqIfPresent(ProcessingInfomationOperationDO::getOperationId, reqVO.getOperationId())
                .eqIfPresent(ProcessingInfomationOperationDO::getIsKey, reqVO.getIsKey())
                .eqIfPresent(ProcessingInfomationOperationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProcessingInfomationOperationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProcessingInfomationOperationDO::getId));
    }

}