package com.zt.plat.module.qms.business.other.dal.mapper;

import java.util.*;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.other.controller.vo.*;
import com.zt.plat.module.qms.business.other.dal.dataobject.OtherBaseSampleDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 第三方系统样品大类对应 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface OtherBaseSampleMapper extends BaseMapperX<OtherBaseSampleDO> {

    default PageResult<OtherBaseSampleDO> selectPage(OtherBaseSamplePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OtherBaseSampleDO>()
                .eqIfPresent(OtherBaseSampleDO::getOtherSystem, reqVO.getOtherSystem())
                .eqIfPresent(OtherBaseSampleDO::getBaseSampleId, reqVO.getBaseSampleId())
                .eqIfPresent(OtherBaseSampleDO::getOtherId, reqVO.getOtherId())
                .eqIfPresent(OtherBaseSampleDO::getOtherType, reqVO.getOtherType())
                .likeIfPresent(OtherBaseSampleDO::getOtherName, reqVO.getOtherName())
                .likeIfPresent(OtherBaseSampleDO::getOtherSimpleName, reqVO.getOtherSimpleName())
                .eqIfPresent(OtherBaseSampleDO::getOtherCode, reqVO.getOtherCode())
                .eqIfPresent(OtherBaseSampleDO::getOtherSimpleCode, reqVO.getOtherSimpleCode())
                .eqIfPresent(OtherBaseSampleDO::getOtherDescription, reqVO.getOtherDescription())
                .eqIfPresent(OtherBaseSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(OtherBaseSampleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OtherBaseSampleDO::getRemark, reqVO.getRemark())
                .orderByDesc(OtherBaseSampleDO::getId));
    }
    
    default List<OtherBaseSampleDO> selectByOtherSystemAndOtherIds(String otherSystem, List<String> otherIdList) {
    	return selectList(new LambdaQueryWrapperX<OtherBaseSampleDO>()
    			.eq(OtherBaseSampleDO::getOtherSystem, otherSystem)
    			.in(OtherBaseSampleDO::getOtherId, otherIdList));
    }

}