package com.cy.guoyan.admin.module.guoyan.dal.mysql.researchtopiccategory;

import java.util.*;

import com.cy.guoyan.admin.framework.common.pojo.PageResult;
import com.cy.guoyan.admin.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cy.guoyan.admin.framework.mybatis.core.mapper.BaseMapperX;
import com.cy.guoyan.admin.module.guoyan.dal.dataobject.researchtopiccategory.ResearchTopicCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import com.cy.guoyan.admin.module.guoyan.controller.admin.researchtopiccategory.vo.*;

/**
 * 国资研究专题分类 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ResearchTopicCategoryMapper extends BaseMapperX<ResearchTopicCategoryDO> {

    default PageResult<ResearchTopicCategoryDO> selectPage(ResearchTopicCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResearchTopicCategoryDO>()
                .eqIfPresent(ResearchTopicCategoryDO::getOid, reqVO.getOid())
                .eqIfPresent(ResearchTopicCategoryDO::getCategoryCode, reqVO.getCategoryCode())
                .likeIfPresent(ResearchTopicCategoryDO::getCategoryName, reqVO.getCategoryName())
                .likeIfPresent(ResearchTopicCategoryDO::getCreatorName, reqVO.getCreatorName())
                .eqIfPresent(ResearchTopicCategoryDO::getLevel, reqVO.getLevel())
                .eqIfPresent(ResearchTopicCategoryDO::getParentCode, reqVO.getParentCode())
                .likeIfPresent(ResearchTopicCategoryDO::getParentName, reqVO.getParentName())
                .eqIfPresent(ResearchTopicCategoryDO::getLevel1Code, reqVO.getLevel1Code())
                .likeIfPresent(ResearchTopicCategoryDO::getLevel1Name, reqVO.getLevel1Name())
                .eqIfPresent(ResearchTopicCategoryDO::getLevel2Code, reqVO.getLevel2Code())
                .likeIfPresent(ResearchTopicCategoryDO::getLevel2Name, reqVO.getLevel2Name())
                .eqIfPresent(ResearchTopicCategoryDO::getOrder1, reqVO.getOrder1())
                .eqIfPresent(ResearchTopicCategoryDO::getOrder2, reqVO.getOrder2())
                .betweenIfPresent(ResearchTopicCategoryDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ResearchTopicCategoryDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ResearchTopicCategoryDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ResearchTopicCategoryDO::getArticleCount, reqVO.getArticleCount())
                .eq(ResearchTopicCategoryDO::getStatus,"正常")
                .orderByAsc(ResearchTopicCategoryDO::getOrder1)
                .orderByAsc(ResearchTopicCategoryDO::getOrder2));
    }

}