package com.jojubanking.boot.module.system.dal.mysql.information;

import java.util.*;

import com.jojubanking.boot.framework.common.pojo.PageResult;
import com.jojubanking.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jojubanking.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.jojubanking.boot.module.system.dal.dataobject.information.InformationDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.information.vo.*;

/**
 * 指南信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface InformationMapper extends BaseMapperX<InformationDO> {

    default PageResult<InformationDO> selectPage(InformationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InformationDO>()
                .eqIfPresent(InformationDO::getTitle, reqVO.getTitle())
                .eqIfPresent(InformationDO::getImg, reqVO.getImg())
                .eqIfPresent(InformationDO::getContent, reqVO.getContent())
                .eqIfPresent(InformationDO::getType, reqVO.getType())
                .betweenIfPresent(InformationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InformationDO::getId));
    }

    default List<InformationDO> selectList(InformationExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InformationDO>()
                .eqIfPresent(InformationDO::getTitle, reqVO.getTitle())
                .eqIfPresent(InformationDO::getImg, reqVO.getImg())
                .eqIfPresent(InformationDO::getContent, reqVO.getContent())
                .eqIfPresent(InformationDO::getType, reqVO.getType())
                .betweenIfPresent(InformationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InformationDO::getId));
    }

}
