package cn.iocoder.yudao.module.configure.dal.mysql.materialmanagement;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.configure.dal.dataobject.materialmanagement.MaterialManagementDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.configure.controller.admin.materialmanagement.vo.*;

/**
 * 素材管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MaterialManagementMapper extends BaseMapperX<MaterialManagementDO> {

    default PageResult<MaterialManagementDO> selectPage(MaterialManagementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialManagementDO>()
                .eqIfPresent(MaterialManagementDO::getGroupId, reqVO.getGroupId())
                .likeIfPresent(MaterialManagementDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(MaterialManagementDO::getMaterialUrl, reqVO.getMaterialUrl())
                .betweenIfPresent(MaterialManagementDO::getCreateTime, reqVO.getCreateTime())
                .eq(MaterialManagementDO::getDeleted,0)
                .orderByDesc(MaterialManagementDO::getId));
    }

}
