package cn.iocoder.yudao.module.configure.dal.mysql.inspectionitem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.configure.dal.dataobject.inspectionitem.InspectionItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.configure.controller.admin.inspectionitem.vo.*;

/**
 * 检测报告模板检测项目 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InspectionItemMapper extends BaseMapperX<InspectionItemDO> {

    default PageResult<InspectionItemDO> selectPage(InspectionItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectionItemDO>()
                .eqIfPresent(InspectionItemDO::getTemplateId, reqVO.getTemplateId())
                .likeIfPresent(InspectionItemDO::getTemplateName, reqVO.getTemplateName())
                .eqIfPresent(InspectionItemDO::getInspectionItem, reqVO.getInspectionItem())
                .eqIfPresent(InspectionItemDO::getInspectionItemId, reqVO.getInspectionItemId())
                .eqIfPresent(InspectionItemDO::getInspectionUnit, reqVO.getInspectionUnit())
                .eqIfPresent(InspectionItemDO::getInspectionRequire, reqVO.getInspectionRequire())
                .eqIfPresent(InspectionItemDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(InspectionItemDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .betweenIfPresent(InspectionItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionItemDO::getId));
    }

}
