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

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.label.LabelDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.label.vo.*;

/**
 * 信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface LabelMapper extends BaseMapperX<LabelDO> {

    default PageResult<LabelDO> selectPage(LabelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LabelDO>()
                .likeIfPresent(LabelDO::getName, reqVO.getName())
                .eqIfPresent(LabelDO::getInfo, reqVO.getInfo())
                .eqIfPresent(LabelDO::getFid, reqVO.getFid())
                .eqIfPresent(LabelDO::getBid, reqVO.getBid())
                .betweenIfPresent(LabelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LabelDO::getId));
    }

    default List<LabelDO> selectList(LabelExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<LabelDO>()
                .likeIfPresent(LabelDO::getName, reqVO.getName())
                .eqIfPresent(LabelDO::getInfo, reqVO.getInfo())
                .eqIfPresent(LabelDO::getFid, reqVO.getFid())
                .eqIfPresent(LabelDO::getBid, reqVO.getBid())
                .betweenIfPresent(LabelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LabelDO::getId));
    }

}
