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

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

/**
 * 问卷调查 Mapper
 *
 * @author admin
 */
@Mapper
public interface WqMapper extends BaseMapperX<WqDO> {

    default PageResult<WqDO> selectPage(WqPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WqDO>()
                .eqIfPresent(WqDO::getTitle, reqVO.getTitle())
                .eqIfPresent(WqDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(WqDO::getType, reqVO.getType())
                .betweenIfPresent(WqDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WqDO::getId));
    }

    default List<WqDO> selectList(WqExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WqDO>()
                .eqIfPresent(WqDO::getTitle, reqVO.getTitle())
                .eqIfPresent(WqDO::getTypeId, reqVO.getTypeId())
                .eqIfPresent(WqDO::getType, reqVO.getType())
                .betweenIfPresent(WqDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WqDO::getId));
    }

}
