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

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

/**
 * 导诊管理 Mapper
 *
 * @author admin
 */
@Mapper
public interface DzQuestionMapper extends BaseMapperX<DzQuestionDO> {

    default PageResult<DzQuestionDO> selectPage(DzQuestionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DzQuestionDO>()
                .eqIfPresent(DzQuestionDO::getQuestion, reqVO.getQuestion())
                .likeIfPresent(DzQuestionDO::getDepartmentName, reqVO.getDepartmentName())
                .eqIfPresent(DzQuestionDO::getDepartmentNo, reqVO.getDepartmentNo())
                .eqIfPresent(DzQuestionDO::getBodyAreaType, reqVO.getBodyAreaType())
                .likeIfPresent(DzQuestionDO::getBodyArerName, reqVO.getBodyArerName())
                .eqIfPresent(DzQuestionDO::getQuestionType, reqVO.getQuestionType())
                .likeIfPresent(DzQuestionDO::getQuestionTypeName, reqVO.getQuestionTypeName())
                .betweenIfPresent(DzQuestionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DzQuestionDO::getId));
    }

    default List<DzQuestionDO> selectList(DzQuestionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DzQuestionDO>()
                .eqIfPresent(DzQuestionDO::getQuestion, reqVO.getQuestion())
                .likeIfPresent(DzQuestionDO::getDepartmentName, reqVO.getDepartmentName())
                .eqIfPresent(DzQuestionDO::getDepartmentNo, reqVO.getDepartmentNo())
                .eqIfPresent(DzQuestionDO::getBodyAreaType, reqVO.getBodyAreaType())
                .likeIfPresent(DzQuestionDO::getBodyArerName, reqVO.getBodyArerName())
                .eqIfPresent(DzQuestionDO::getQuestionType, reqVO.getQuestionType())
                .likeIfPresent(DzQuestionDO::getQuestionTypeName, reqVO.getQuestionTypeName())
                .betweenIfPresent(DzQuestionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DzQuestionDO::getId));
    }

}
