package com.baichuanxin.openrestapi.service.impl;

import com.baichuanxin.openrestapi.dao.mapper.RegionCodeMapper;
import com.baichuanxin.openrestapi.entity.RegionCode;
import com.baichuanxin.openrestapi.service.RegionCodeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class RegionCodeServiceImpl extends ServiceImpl<RegionCodeMapper,RegionCode> implements RegionCodeService {
    @Override
    public RegionCode getRegionCode(String regionCode) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("region_code",regionCode);
        queryWrapper.last("limit 1 ");
        return  this.getOne(queryWrapper);

    }
}
