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

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

/**
 * 问卷调查问题 Mapper
 *
 * @author admin
 */
@Mapper
public interface WqwtMapper extends BaseMapperX<WqwtDO> {

    default PageResult<WqwtDO> selectPage(WqwtPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WqwtDO>()
                .eqIfPresent(WqwtDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(WqwtDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(WqwtDO::getPid, reqVO.getPid())
                .eqIfPresent(WqwtDO::getGradingType, reqVO.getGradingType())
                .eqIfPresent(WqwtDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(WqwtDO::getQuestionTitle, reqVO.getQuestionTitle())
                .eqIfPresent(WqwtDO::getQuestionOpnum, reqVO.getQuestionOpnum())
                .eqIfPresent(WqwtDO::getQuestionContent, reqVO.getQuestionContent())
                .betweenIfPresent(WqwtDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WqwtDO::getId));
    }

    default List<WqwtDO> selectList(WqwtExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WqwtDO>()
                .eqIfPresent(WqwtDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(WqwtDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(WqwtDO::getPid, reqVO.getPid())
                .eqIfPresent(WqwtDO::getGradingType, reqVO.getGradingType())
                .eqIfPresent(WqwtDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(WqwtDO::getQuestionTitle, reqVO.getQuestionTitle())
                .eqIfPresent(WqwtDO::getQuestionOpnum, reqVO.getQuestionOpnum())
                .eqIfPresent(WqwtDO::getQuestionContent, reqVO.getQuestionContent())
                .betweenIfPresent(WqwtDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WqwtDO::getId));
    }

}
