package com.zt.plat.module.qms.business.config.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.config.controller.vo.MaterialAssayStandardMethodPageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.MaterialAssayStandardMethodDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 物料检测标准与方法 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface MaterialAssayStandardMethodMapper extends BaseMapperX<MaterialAssayStandardMethodDO> {

    default PageResult<MaterialAssayStandardMethodDO> selectPage(MaterialAssayStandardMethodPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialAssayStandardMethodDO>()
                .eqIfPresent(MaterialAssayStandardMethodDO::getMaterialAssayStandardDetailId, reqVO.getMaterialAssayStandardDetailId())
                .eqIfPresent(MaterialAssayStandardMethodDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
                .eqIfPresent(MaterialAssayStandardMethodDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
                .likeIfPresent(MaterialAssayStandardMethodDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
                .eqIfPresent(MaterialAssayStandardMethodDO::getIsDualCup, reqVO.getIsDualCup())
                .eqIfPresent(MaterialAssayStandardMethodDO::getIsDefault, reqVO.getIsDefault())
                .eqIfPresent(MaterialAssayStandardMethodDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(MaterialAssayStandardMethodDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(MaterialAssayStandardMethodDO::getRemark, reqVO.getRemark())
                .orderByDesc(MaterialAssayStandardMethodDO::getId));
    }

}