package com.zt.plat.module.qms.resource.record.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.record.controller.admin.recordcategory.vo.RecordCategoryPageReqVO;
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordcategory.RecordCategoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件记录分类 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface RecordCategoryMapper extends BaseMapperX<RecordCategoryDO> {

    default PageResult<RecordCategoryDO> selectPage(RecordCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecordCategoryDO>()
                .eqIfPresent(RecordCategoryDO::getParentId, reqVO.getParentId())
                .eqIfPresent(RecordCategoryDO::getIdPath, reqVO.getIdPath())
                .likeIfPresent(RecordCategoryDO::getName, reqVO.getName())
                .eqIfPresent(RecordCategoryDO::getBusinessType, reqVO.getBusinessType())
                .likeIfPresent(RecordCategoryDO::getModuleName, reqVO.getModuleName())
                .eqIfPresent(RecordCategoryDO::getModuleCode, reqVO.getModuleCode())
                .eqIfPresent(RecordCategoryDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(RecordCategoryDO::getDataSource, reqVO.getDataSource())
                .eqIfPresent(RecordCategoryDO::getDataDimension, reqVO.getDataDimension())
                .eqIfPresent(RecordCategoryDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(RecordCategoryDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(RecordCategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecordCategoryDO::getId));
    }

}