package com.trs.digital.module.manager.dal.mysql.digsearch;

import java.util.*;

import com.trs.digital.framework.common.pojo.PageResult;
import com.trs.digital.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.trs.digital.framework.mybatis.core.mapper.BaseMapperX;
import com.trs.digital.module.manager.dal.dataobject.digsearch.DigsearchDO;
import org.apache.ibatis.annotations.Mapper;
import com.trs.digital.module.manager.controller.admin.digsearch.vo.*;

/**
 * 资源搜索 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface DigsearchMapper extends BaseMapperX<DigsearchDO> {

    default PageResult<DigsearchDO> selectPage(DigsearchPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DigsearchDO>()
                .eqIfPresent(DigsearchDO::getId, reqVO.getId())
                .eqIfPresent(DigsearchDO::getRemark, reqVO.getRemark())
                .eqIfPresent(DigsearchDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(DigsearchDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DigsearchDO::getUpdater, reqVO.getUpdater())
                .betweenIfPresent(DigsearchDO::getUpdateTime, reqVO.getUpdateTime())
                .eqIfPresent(DigsearchDO::getDeleted, reqVO.getDeleted())
                .eqIfPresent(DigsearchDO::getDocTitle, reqVO.getDocTitle())
                .eqIfPresent(DigsearchDO::getDocContent, reqVO.getDocContent())
                .eqIfPresent(DigsearchDO::getDocContentTranslate, reqVO.getDocContentTranslate())
                .likeIfPresent(DigsearchDO::getFileName, reqVO.getFileName())
                .eqIfPresent(DigsearchDO::getFilePath, reqVO.getFilePath())
                .eqIfPresent(DigsearchDO::getFileType, reqVO.getFileType())
                .betweenIfPresent(DigsearchDO::getFileCrtime, reqVO.getFileCrtime())
                .betweenIfPresent(DigsearchDO::getFileUpdatetime, reqVO.getFileUpdatetime())
                .eqIfPresent(DigsearchDO::getDocLable, reqVO.getDocLable())
                .likeIfPresent(DigsearchDO::getSourcename, reqVO.getSourcename())
                .eqIfPresent(DigsearchDO::getLanguage, reqVO.getLanguage())
                .orderByDesc(DigsearchDO::getId));
    }

}