修改了查询护林员信息的代码模块,分为省市两级查询

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-02 14:41:44 +08:00
parent 475925322a
commit fec2659d46

View File

@ -50,14 +50,14 @@ public class ForestRangerServiceImpl implements ForestRangerService {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
String tokenUserName = TokenUtil.getTokenUserName(token); String tokenUserName = TokenUtil.getTokenUserName(token);
if("370000".equals(countyCode)){ if(countyCode.substring(2).equals("0000")){
List<ForestRanger> all = forestRangerDao.findAll(); List<ForestRanger> allsByRangerCountyCode = forestRangerDao.findAllsByRangerCountyCode(countyCode.substring(0,2));
if(all == null || all.size() == 0){ if(allsByRangerCountyCode == null || allsByRangerCountyCode.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没该省护林员的信息",locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没该省护林员的信息",locale);
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,all,locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,allsByRangerCountyCode,locale);
}else { }else {
List<ForestRanger> allByRangerCountyCode = forestRangerDao.findAllsByRangerCountyCode(countyCode); List<ForestRanger> allByRangerCountyCode = forestRangerDao.findAllsByRangerCountyCode(countyCode.substring(0,4));
if(allByRangerCountyCode == null || allByRangerCountyCode.size() == 0){ if(allByRangerCountyCode == null || allByRangerCountyCode.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没该市护林员的信息",locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没该市护林员的信息",locale);
} }