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.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleHandoverDetailPageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleHandoverDetailDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 样品交接明细 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessSampleHandoverDetailMapper extends BaseMapperX<BusinessSampleHandoverDetailDO> {

    default PageResult<BusinessSampleHandoverDetailDO> selectPage(BusinessSampleHandoverDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessSampleHandoverDetailDO>()
                .eqIfPresent(BusinessSampleHandoverDetailDO::getBusinessSampleHandoverId, reqVO.getBusinessSampleHandoverId())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId())
                .likeIfPresent(BusinessSampleHandoverDetailDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getSampleCode, reqVO.getSampleCode())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getSampleWeight, reqVO.getSampleWeight())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getBalanceCode, reqVO.getBalanceCode())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .likeIfPresent(BusinessSampleHandoverDetailDO::getDictionaryBusinessName, reqVO.getDictionaryBusinessName())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessSampleHandoverDetailDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessSampleHandoverDetailDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessSampleHandoverDetailDO::getId));
    }

}