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

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.materialgroup.MaterialGroupDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.configure.controller.admin.materialgroup.vo.*;

/**
 * 素材管理分组 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MaterialGroupMapper extends BaseMapperX<MaterialGroupDO> {

    default PageResult<MaterialGroupDO> selectPage(MaterialGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialGroupDO>()
                .likeIfPresent(MaterialGroupDO::getGroupName, reqVO.getGroupName())
                .betweenIfPresent(MaterialGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(MaterialGroupDO::getId));
    }

    default List<MaterialGroupDO> selectList(MaterialGroupPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MaterialGroupDO>()
                .likeIfPresent(MaterialGroupDO::getGroupName, reqVO.getGroupName())
                .betweenIfPresent(MaterialGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(MaterialGroupDO::getId));
    }

}
