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

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

/**
 * 医院信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface HospitalMapper extends BaseMapperX<HospitalDO> {

    default PageResult<HospitalDO> selectPage(HospitalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HospitalDO>()
                .likeIfPresent(HospitalDO::getName, reqVO.getName())
                .eqIfPresent(HospitalDO::getLogo, reqVO.getLogo())
                .eqIfPresent(HospitalDO::getLabel, reqVO.getLabel())
                .eqIfPresent(HospitalDO::getTel, reqVO.getTel())
                .eqIfPresent(HospitalDO::getAddress, reqVO.getAddress())
                .eqIfPresent(HospitalDO::getContent, reqVO.getContent())
                .eqIfPresent(HospitalDO::getImg, reqVO.getImg())
                .betweenIfPresent(HospitalDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HospitalDO::getId));
    }

    default List<HospitalDO> selectList(HospitalExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<HospitalDO>()
                .likeIfPresent(HospitalDO::getName, reqVO.getName())
                .eqIfPresent(HospitalDO::getLogo, reqVO.getLogo())
                .eqIfPresent(HospitalDO::getLabel, reqVO.getLabel())
                .eqIfPresent(HospitalDO::getTel, reqVO.getTel())
                .eqIfPresent(HospitalDO::getAddress, reqVO.getAddress())
                .eqIfPresent(HospitalDO::getContent, reqVO.getContent())
                .eqIfPresent(HospitalDO::getImg, reqVO.getImg())
                .betweenIfPresent(HospitalDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HospitalDO::getId));
    }

}
