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.dal.dataobject.recordfileattachment.RecordFileAttachmentDO;
import com.zt.plat.module.qms.resource.record.controller.admin.recordfileattachment.vo.RecordFileAttachmentPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件记录附件 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface RecordFileAttachmentMapper extends BaseMapperX<RecordFileAttachmentDO> {

    default PageResult<RecordFileAttachmentDO> selectPage(RecordFileAttachmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecordFileAttachmentDO>()
                .eqIfPresent(RecordFileAttachmentDO::getRecordId, reqVO.getRecordId())
                .eqIfPresent(RecordFileAttachmentDO::getFileId, reqVO.getFileId())
                .eqIfPresent(RecordFileAttachmentDO::getMainId, reqVO.getMainId())
                .eqIfPresent(RecordFileAttachmentDO::getCurrentFlag, reqVO.getCurrentFlag())
                .eqIfPresent(RecordFileAttachmentDO::getFileVersion, reqVO.getFileVersion())
                .eqIfPresent(RecordFileAttachmentDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(RecordFileAttachmentDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(RecordFileAttachmentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecordFileAttachmentDO::getId));
    }

}