package com.zt.plat.module.qms.business.bus.dal.mapper;

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.qms.business.bus.controller.vo.BusinessSampleDispatchPageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleDispatchDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 样品调拨 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessSampleDispatchMapper extends BaseMapperX<BusinessSampleDispatchDO> {

    default PageResult<BusinessSampleDispatchDO> selectPage(BusinessSampleDispatchPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessSampleDispatchDO>()
                .eqIfPresent(BusinessSampleDispatchDO::getMainDepartmentId, reqVO.getMainDepartmentId())
                .likeIfPresent(BusinessSampleDispatchDO::getMainDepartmentName, reqVO.getMainDepartmentName())
                .eqIfPresent(BusinessSampleDispatchDO::getApplyUser, reqVO.getApplyUser())
                .eqIfPresent(BusinessSampleDispatchDO::getApplyUserId, reqVO.getApplyUserId())
                .eqIfPresent(BusinessSampleDispatchDO::getApplyDepartment, reqVO.getApplyDepartment())
                .eqIfPresent(BusinessSampleDispatchDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
                .betweenIfPresent(BusinessSampleDispatchDO::getApplyTime, reqVO.getApplyTime())
                .eqIfPresent(BusinessSampleDispatchDO::getWarehouseUser, reqVO.getWarehouseUser())
                .eqIfPresent(BusinessSampleDispatchDO::getWarehouseUserId, reqVO.getWarehouseUserId())
                .eqIfPresent(BusinessSampleDispatchDO::getSubmitStatus, reqVO.getSubmitStatus())
                .eqIfPresent(BusinessSampleDispatchDO::getFlowInstanceId, reqVO.getFlowInstanceId())
                .eqIfPresent(BusinessSampleDispatchDO::getFlowStatus, reqVO.getFlowStatus())
                .eqIfPresent(BusinessSampleDispatchDO::getFinishStatus, reqVO.getFinishStatus())
                .eqIfPresent(BusinessSampleDispatchDO::getCancelStatus, reqVO.getCancelStatus())
                .eqIfPresent(BusinessSampleDispatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(BusinessSampleDispatchDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BusinessSampleDispatchDO::getCreateTime, reqVO.getCreateTime())
                .ne(BusinessSampleDispatchDO::getCancelStatus, "-1")
                .orderByDesc(BusinessSampleDispatchDO::getId));
    }

}