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

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

/**
 * 医生信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface DoctorMapper extends BaseMapperX<DoctorDO> {

    default PageResult<DoctorDO> selectPage(DoctorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DoctorDO>()
                .likeIfPresent(DoctorDO::getName, reqVO.getName())
                .eqIfPresent(DoctorDO::getImg, reqVO.getImg())
                .eqIfPresent(DoctorDO::getMid, reqVO.getMid())
                .eqIfPresent(DoctorDO::getInfo, reqVO.getInfo())
                .eqIfPresent(DoctorDO::getGrsc, reqVO.getGrsc())
                .betweenIfPresent(DoctorDO::getZztime, reqVO.getZztime())
                .eqIfPresent(DoctorDO::getLabel, reqVO.getLabel())
                .betweenIfPresent(DoctorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DoctorDO::getId));
    }

    default List<DoctorDO> selectList(DoctorExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DoctorDO>()
                .likeIfPresent(DoctorDO::getName, reqVO.getName())
                .eqIfPresent(DoctorDO::getImg, reqVO.getImg())
                .eqIfPresent(DoctorDO::getMid, reqVO.getMid())
                .eqIfPresent(DoctorDO::getInfo, reqVO.getInfo())
                .eqIfPresent(DoctorDO::getGrsc, reqVO.getGrsc())
                .betweenIfPresent(DoctorDO::getZztime, reqVO.getZztime())
                .eqIfPresent(DoctorDO::getLabel, reqVO.getLabel())
                .betweenIfPresent(DoctorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DoctorDO::getId));
    }

}
