|
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service; |
|
|
import tools.BeanTools; |
|
|
import tools.BeanTools; |
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @program: DataPushServer |
|
|
* @program: DataPushServer |
|
@@ -56,14 +57,13 @@ public class ProvinceInfoServiceImpl implements IProvinceInfoService { |
|
|
ProvinceInfoEntity query = new ProvinceInfoEntity(); |
|
|
ProvinceInfoEntity query = new ProvinceInfoEntity(); |
|
|
query.setProvince(provicne); |
|
|
query.setProvince(provicne); |
|
|
Example<ProvinceInfoEntity> example = Example.of(query); |
|
|
Example<ProvinceInfoEntity> example = Example.of(query); |
|
|
PageRequest pageable = PageRequest.of(0, 1); |
|
|
|
|
|
Page<ProvinceInfoEntity> data = provinceInfoMapper.findAll(example, pageable); |
|
|
|
|
|
if (CollectionUtil.isNotEmpty(data.getContent())) { |
|
|
|
|
|
List<ProvinceInfoEntity> provinceInfos = BeanTools.copyList(data.getContent(), ProvinceInfoEntity.class); |
|
|
|
|
|
return provinceInfos.get(0); |
|
|
|
|
|
} else { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// PageRequest pageable = PageRequest.of(0, 1); |
|
|
|
|
|
Optional<ProvinceInfoEntity> data = provinceInfoMapper.findOne(example); |
|
|
|
|
|
// if (CollectionUtil.isNotEmpty(data.getContent())) { |
|
|
|
|
|
// |
|
|
|
|
|
// List<ProvinceInfoEntity> provinceInfos = BeanTools.copyList(data.getContent(), ProvinceInfoEntity.class); |
|
|
|
|
|
// return provinceInfos.get(0); |
|
|
|
|
|
return data.get(); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("获取省份异常:", e); |
|
|
log.error("获取省份异常:", e); |
|
|
return null; |
|
|
return null; |
|
|