修改了查询各省市的区县名称和编码的家口
This commit is contained in:
parent
52fe47e483
commit
dc9c235745
@ -247,11 +247,16 @@ public class FirePointController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectCityName")
|
@GetMapping("/selectCityName")
|
||||||
public String selectCityName(){
|
public String selectCityName(@RequestParam("code") String code){
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<Map<String, Object>> maps = firePointService.selectCityName();
|
if(code.substring(2).equals("0000")){
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
|
List<Map<String, Object>> maps = firePointService.selectCityName(code);
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
|
||||||
|
}else {
|
||||||
|
List<Map<String, Object>> maps = firePointService.selectCountyName(code);
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,8 +25,9 @@ public interface CityDao extends JpaRepository<CityEntity,Long>, JpaSpecificatio
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有市和对应的编码
|
* 查询所有市和对应的编码
|
||||||
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "select city_name cityname,city_code citycode from city",nativeQuery = true)
|
@Query(value = "select city_name cityname,city_code citycode from city where pro_code = :code",nativeQuery = true)
|
||||||
List<Map<String,Object>> selectCityName();
|
List<Map<String,Object>> selectCityName(String code);
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,22 @@ package com.xkrs.dao;
|
|||||||
|
|
||||||
import com.xkrs.model.entity.CountyEntity;
|
import com.xkrs.model.entity.CountyEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author XinYi Song
|
* @author XinYi Song
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public interface CountyDao extends JpaRepository<CountyEntity,Long> {
|
public interface CountyDao extends JpaRepository<CountyEntity,Long> {
|
||||||
|
/**
|
||||||
|
* 查询市包含的区县和编码
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Query(value = "select county_name cityname,county_code citycode from county where city_code = :code",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> selectCountyName(String code);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,15 @@ public interface FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该省所有的市
|
* 查询该省所有的市
|
||||||
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> selectCityName();
|
List<Map<String,Object>> selectCityName(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询市包含的区县和编码
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> selectCountyName(String code);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,9 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CityDao cityDao;
|
private CityDao cityDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CountyDao countyDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加火点信息
|
* 添加火点信息
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
@ -386,10 +389,21 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该省所有的市
|
* 查询该省所有的市
|
||||||
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> selectCityName() {
|
public List<Map<String, Object>> selectCityName(String code) {
|
||||||
return cityDao.selectCityName();
|
return cityDao.selectCityName(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询市包含的区县和编码
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectCountyName(String code) {
|
||||||
|
return countyDao.selectCountyName(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user