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.BaseSamplePageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 样品大类管理 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BaseSampleMapper extends BaseMapperX<BaseSampleDO> {

    default PageResult<BaseSampleDO> selectPage(BaseSamplePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseSampleDO>()
                .likeIfPresent(BaseSampleDO::getName, reqVO.getName())
                .eqIfPresent(BaseSampleDO::getMaterialId, reqVO.getMaterialId())
                .eqIfPresent(BaseSampleDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(BaseSampleDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(BaseSampleDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .eqIfPresent(BaseSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BaseSampleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BaseSampleDO::getRemark, reqVO.getRemark())
                .orderByDesc(BaseSampleDO::getId));
    }

    List<BaseSampleDO> getBaseSampleListWithAssayStandardCount();

}