package cn.iocoder.yudao.module.system.dal.mysql.commonlyused;

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.system.dal.dataobject.commonlyused.CommonlyUsedDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.commonlyused.vo.*;

/**
 * 用户常用应用配置 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface CommonlyUsedMapper extends BaseMapperX<CommonlyUsedDO> {

    default PageResult<CommonlyUsedDO> selectPage(CommonlyUsedPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommonlyUsedDO>()
                .eqIfPresent(CommonlyUsedDO::getUserId, reqVO.getUserId())
                .eqIfPresent(CommonlyUsedDO::getType, reqVO.getType())
                .eqIfPresent(CommonlyUsedDO::getObjectId, reqVO.getObjectId())
                .eqIfPresent(CommonlyUsedDO::getSort, reqVO.getSort())
                .betweenIfPresent(CommonlyUsedDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CommonlyUsedDO::getId));
    }

}
