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

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.wqdaview.WqdaViewCustDO;
import com.jojubanking.boot.module.system.dal.dataobject.wqdaview.WqdaViewDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.wqdaview.vo.*;

/**
 * VIEW Mapper
 *
 * @author admin
 */
@Mapper
public interface WqdaViewMapper extends BaseMapperX<WqdaViewDO> {

    default PageResult<WqdaViewDO> selectPage(WqdaViewPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WqdaViewDO>()
                .eqIfPresent(WqdaViewDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(WqdaViewDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(WqdaViewDO::getQuestionType, reqVO.getQuestionType())
                .likeIfPresent(WqdaViewDO::getQuestionTitle, reqVO.getQuestionTitle())
                .likeIfPresent(WqdaViewDO::getQuestionAnswer, reqVO.getQuestionAnswer())
                .likeIfPresent(WqdaViewDO::getQuestionComment, reqVO.getQuestionComment())
                .likeIfPresent(WqdaViewDO::getUsername, reqVO.getUsername())
                .likeIfPresent(WqdaViewDO::getUsertel, reqVO.getUsertel())
                .betweenIfPresent(WqdaViewDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WqdaViewDO::getQuestionLabel, reqVO.getQuestionLabel())
                .orderByDesc(WqdaViewDO::getId));
    }

    default List<WqdaViewDO> selectList(WqdaViewExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WqdaViewDO>()
                .eqIfPresent(WqdaViewDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(WqdaViewDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(WqdaViewDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(WqdaViewDO::getQuestionTitle, reqVO.getQuestionTitle())
                .eqIfPresent(WqdaViewDO::getQuestionAnswer, reqVO.getQuestionAnswer())
                .eqIfPresent(WqdaViewDO::getQuestionComment, reqVO.getQuestionComment())
                .likeIfPresent(WqdaViewDO::getUsername, reqVO.getUsername())
                .eqIfPresent(WqdaViewDO::getUsertel, reqVO.getUsertel())
                .betweenIfPresent(WqdaViewDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WqdaViewDO::getQuestionLabel, reqVO.getQuestionLabel())
                .orderByDesc(WqdaViewDO::getId));
    }

}
