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

/**
 * 标准样业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessStandardSampleMapper extends BaseMapperX<BusinessStandardSampleDO> {

    default PageResult<BusinessStandardSampleDO> selectPage(BusinessStandardSamplePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessStandardSampleDO>()
                .eqIfPresent(BusinessStandardSampleDO::getConfigStandardSampleTypeId, reqVO.getConfigStandardSampleTypeId())
                .likeIfPresent(BusinessStandardSampleDO::getConfigStandardSampleTypeName, reqVO.getConfigStandardSampleTypeName())
                .eqIfPresent(BusinessStandardSampleDO::getStandardSampleCode, reqVO.getStandardSampleCode())
                .eqIfPresent(BusinessStandardSampleDO::getIsUse, reqVO.getIsUse())
                .eqIfPresent(BusinessStandardSampleDO::getIsPublish, reqVO.getIsPublish())
                .eqIfPresent(BusinessStandardSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessStandardSampleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessStandardSampleDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessStandardSampleDO::getId));
    }

}