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.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigBaseSamplePageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigBaseSampleDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;

/**
 * 主样配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigBaseSampleMapper extends BaseMapperX<ConfigBaseSampleDO> {

    default PageResult<ConfigBaseSampleDO> selectPage(ConfigBaseSamplePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigBaseSampleDO>()
                .eqIfPresent(ConfigBaseSampleDO::getBaseSampleId, reqVO.getBaseSampleId())
                .eqIfPresent(ConfigBaseSampleDO::getParentId, reqVO.getParentId())
                .eqIfPresent(ConfigBaseSampleDO::getCodeRule, reqVO.getCodeRule())
                .eqIfPresent(ConfigBaseSampleDO::getFlowKey, reqVO.getFlowKey())
                .eqIfPresent(ConfigBaseSampleDO::getPrintTemplate, reqVO.getPrintTemplate())
                .eqIfPresent(ConfigBaseSampleDO::getCodePrintQuantity, reqVO.getCodePrintQuantity())
                .likeIfPresent(ConfigBaseSampleDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(ConfigBaseSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigBaseSampleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigBaseSampleDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ConfigBaseSampleDO::getVersion, reqVO.getVersion())
                .orderByDesc(ConfigBaseSampleDO::getId));
    }
    
    default List<ConfigBaseSampleDO> selectByBaseSampleIds(List<Long> baseSampleIds) {
    	return selectList(new LambdaQueryWrapperX<ConfigBaseSampleDO>()
    			.in(ConfigBaseSampleDO::getBaseSampleId, baseSampleIds));
    }

}