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

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.inspectiontemplate.InspectionTemplateDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.configure.controller.admin.inspectiontemplate.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 检测报告模板 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InspectionTemplateMapper extends BaseMapperX<InspectionTemplateDO> {

    default PageResult<InspectionTemplateDO> selectPage(InspectionTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectionTemplateDO>()
                .likeIfPresent(InspectionTemplateDO::getTemplateName, reqVO.getTemplateName())
                .eqIfPresent(InspectionTemplateDO::getTemplateId, reqVO.getTemplateId())
                .eqIfPresent(InspectionTemplateDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(InspectionTemplateDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .betweenIfPresent(InspectionTemplateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionTemplateDO::getId));
    }

    List<InspectionTemplateRespVO> selectInspectionTemplates(@Param("businessId") Long businessId);

}
