package com.yc.ship.module.ota.dal.mysql.otaRegion;

import java.util.*;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.module.ota.dal.dataobject.otaRegion.OtaRegionDO;
import org.apache.ibatis.annotations.Mapper;
import com.yc.ship.module.ota.controller.admin.otaRegion.vo.*;

/**
 * 地区编码 Mapper
 *
 * @author lsq
 */
@Mapper
public interface OtaRegionMapper extends BaseMapperX<OtaRegionDO> {

    default PageResult<OtaRegionDO> selectPage(OtaRegionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OtaRegionDO>()
                .eqIfPresent(OtaRegionDO::getRegion, reqVO.getRegion())
                .eqIfPresent(OtaRegionDO::getProvince, reqVO.getProvince())
                .eqIfPresent(OtaRegionDO::getCity, reqVO.getCity())
                .eqIfPresent(OtaRegionDO::getCounty, reqVO.getCounty())
                .eqIfPresent(OtaRegionDO::getLevel, reqVO.getLevel())
                .eqIfPresent(OtaRegionDO::getProvinceCode, reqVO.getProvinceCode())
                .orderByDesc(OtaRegionDO::getId));
    }

}