package com.zt.plat.module.base.dal.dao.doctemplate;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryPageReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateCategoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 模板分类 Mapper
 *
 * @author 系统生成
 */
@Mapper
public interface DocTemplateCategoryMapper extends BaseMapperX<DocTemplateCategoryDO> {

    default PageResult<DocTemplateCategoryDO> selectPage(DocTemplateCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DocTemplateCategoryDO>()
                .likeIfPresent(DocTemplateCategoryDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(DocTemplateCategoryDO::getCategoryCode, reqVO.getCategoryCode())
                .eqIfPresent(DocTemplateCategoryDO::getParentId, reqVO.getParentId())
                .eqIfPresent(DocTemplateCategoryDO::getLevel, reqVO.getLevel())
                .orderByAsc(DocTemplateCategoryDO::getSort)
                .orderByDesc(DocTemplateCategoryDO::getId));
    }

}
