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

/**
 * 标准样检测项目业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessStandardSampleProjectMapper extends BaseMapperX<BusinessStandardSampleProjectDO> {

    default PageResult<BusinessStandardSampleProjectDO> selectPage(BusinessStandardSampleProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessStandardSampleProjectDO>()
                .eqIfPresent(BusinessStandardSampleProjectDO::getBusinessStandardSampleId, reqVO.getBusinessStandardSampleId())
                .eqIfPresent(BusinessStandardSampleProjectDO::getConfigStandardSampleProjectId, reqVO.getConfigStandardSampleProjectId())
                .eqIfPresent(BusinessStandardSampleProjectDO::getDictionaryProjectId, reqVO.getDictionaryProjectId())
                .likeIfPresent(BusinessStandardSampleProjectDO::getDictionaryProjectName, reqVO.getDictionaryProjectName())
                .eqIfPresent(BusinessStandardSampleProjectDO::getDictionaryProjectUnit, reqVO.getDictionaryProjectUnit())
                .eqIfPresent(BusinessStandardSampleProjectDO::getStandardValue, reqVO.getStandardValue())
                .eqIfPresent(BusinessStandardSampleProjectDO::getStandardToleraanceValue, reqVO.getStandardToleraanceValue())
                .eqIfPresent(BusinessStandardSampleProjectDO::getDecimalPosition, reqVO.getDecimalPosition())
                .eqIfPresent(BusinessStandardSampleProjectDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(BusinessStandardSampleProjectDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessStandardSampleProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessStandardSampleProjectDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessStandardSampleProjectDO::getId));
    }

}