package cn.aagro.ag.module.infra.dal.mysql.file;

import cn.aagro.ag.framework.common.pojo.PageResult;
import cn.aagro.ag.framework.mybatis.core.mapper.BaseMapperX;
import cn.aagro.ag.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.aagro.ag.module.infra.controller.admin.file.vo.file.FilePageReqVO;
import cn.aagro.ag.module.infra.dal.dataobject.file.FileDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件操作 Mapper
 *
 * @author AIOTAGRO
 */
@Mapper
public interface FileMapper extends BaseMapperX<FileDO> {

    default PageResult<FileDO> selectPage(FilePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FileDO>()
                .likeIfPresent(FileDO::getPath, reqVO.getPath())
                .likeIfPresent(FileDO::getType, reqVO.getType())
                .betweenIfPresent(FileDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FileDO::getId));
    }

}
