package com.telpo.dipperposition.service.impl; import com.telpo.dipperposition.entity.mongo.IpProvinceEntity; import com.telpo.dipperposition.entity.mongo.ProvinceInfoEntity; import com.telpo.dipperposition.mapper.IpProvinceMapper; import com.telpo.dipperposition.mapper.ProvinceInfoMapper; import com.telpo.dipperposition.service.IProvinceInfoService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @program: DataPushServer * @description: 推送记录服务接口实现类 * @author: linwl * @create: 2020-07-20 11:09 */ @Slf4j @Service public class ProvinceInfoServiceImpl implements IProvinceInfoService { @Autowired private ProvinceInfoMapper provinceInfoMapper; @Override public boolean saveProvinceInfo(ProvinceInfoEntity entity) { return false; } @Override public boolean updateProvinceInfoEntity(ProvinceInfoEntity query, ProvinceInfoEntity update) { return false; } @Override public boolean romveById(String id) { provinceInfoMapper.deleteIpById(id); return false; } @Override public ProvinceInfoEntity getProvinceInfo(String provicne) { try { ProvinceInfoEntity query = new ProvinceInfoEntity(); query.setProvince(provicne); List records = provinceInfoMapper.queryIpList(query); if (ObjectUtils.isNotEmpty(records)) { return records.get(0); } else { return null; } } catch (Exception e) { log.error("获取省份异常:", e); return null; } } @Override public List getProvinceInfoEntitys() { try { ProvinceInfoEntity query = new ProvinceInfoEntity(); List records = provinceInfoMapper.queryIpList(query); if (ObjectUtils.isNotEmpty(records)) { return records; } else { return null; } } catch (Exception e) { log.error("获取IP省份异常:", e); return null; } } }