Commit 3ab2d90c authored by 蔡镇泽's avatar 蔡镇泽

省市区查询接口修改

parent 411ebbeb
...@@ -31,7 +31,7 @@ public class DisableController { ...@@ -31,7 +31,7 @@ public class DisableController {
* 省市区 * 省市区
* *
* @param districtLevel 区域级别:1省2地级市3县 * @param districtLevel 区域级别:1省2地级市3县
* @param districtName 上级区域代码 * @param districtName 上级区域
*/ */
@RequestMapping("/district") @RequestMapping("/district")
public Result<List<ChFndDistrict>> district(String districtLevel, String districtName) { public Result<List<ChFndDistrict>> district(String districtLevel, String districtName) {
...@@ -79,7 +79,7 @@ public class DisableController { ...@@ -79,7 +79,7 @@ public class DisableController {
* @param realName 失能人员姓名 * @param realName 失能人员姓名
* @param certiCode 失能人员身份证号码 * @param certiCode 失能人员身份证号码
* @param dataFrom 申请来源 * @param dataFrom 申请来源
* @param srvOrganId 护理机构 * @param srvOrganName 护理机构名称
* @param pageNum 当前页 * @param pageNum 当前页
* @param pageSize 每页几条数据 * @param pageSize 每页几条数据
* @return 失能人员信息列表 * @return 失能人员信息列表
......
...@@ -52,7 +52,7 @@ public interface DisableService { ...@@ -52,7 +52,7 @@ public interface DisableService {
* 省市区 * 省市区
* *
* @param districtLevel 区域级别:1省2地级市3县 * @param districtLevel 区域级别:1省2地级市3县
* @param districtName 上级区域代码 * @param districtName 上级区域
*/ */
List<ChFndDistrict> district(String districtLevel, String districtName); List<ChFndDistrict> district(String districtLevel, String districtName);
......
...@@ -97,26 +97,40 @@ public class DisableServiceImpl implements DisableService { ...@@ -97,26 +97,40 @@ public class DisableServiceImpl implements DisableService {
@Override @Override
public List<ChFndDistrict> district(String districtLevel, String districtName) { public List<ChFndDistrict> district(String districtLevel, String districtName) {
if ("4".equals(districtLevel)) { if ("4".equals(districtLevel)) {
QueryWrapper<ChFndStreet> queryWrapper = new QueryWrapper<>(); //查询区代码
queryWrapper.eq("STREET_NAME", districtName); QueryWrapper<ChFndDistrict> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("IS_VALID", 0); queryWrapper.eq("IS_VALID", "Y");
List<ChFndStreet> fndStreets = fndStreetMapper.selectList(queryWrapper); queryWrapper.eq("DISTRICT_NAME", districtName);
ChFndDistrict chFndDistrict = districtMapper.selectOne(queryWrapper);
QueryWrapper<ChFndStreet> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("IS_VALID", 0);
queryWrapper1.eq("AREA_CODE", chFndDistrict.getDistrictCode());
List<ChFndStreet> fndStreets = fndStreetMapper.selectList(queryWrapper1);
List<ChFndDistrict> resuts = new ArrayList<>(); List<ChFndDistrict> resuts = new ArrayList<>();
for (ChFndStreet chFndStreet : fndStreets) { for (ChFndStreet chFndStreet : fndStreets) {
ChFndDistrict chFndDistrict = new ChFndDistrict(); ChFndDistrict chFndDistrict1 = new ChFndDistrict();
chFndDistrict.setDistrictCode(chFndStreet.getStreetCode()); chFndDistrict1.setDistrictCode(chFndStreet.getStreetCode());
chFndDistrict.setDistrictName(chFndStreet.getStreetName()); chFndDistrict1.setDistrictName(chFndStreet.getStreetName());
chFndDistrict.setParentDistirctCode(chFndStreet.getAreaCode()); chFndDistrict1.setParentDistirctCode(chFndStreet.getAreaCode());
resuts.add(chFndDistrict1);
} }
return resuts; return resuts;
} else { } else {
QueryWrapper<ChFndDistrict> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChFndDistrict> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("IS_VALID", "Y"); queryWrapper.eq("IS_VALID", "Y");
queryWrapper.eq("DISTRICT_LEVEL", districtLevel); if ("1".equals(districtLevel)) {
if (!"1".equals(districtLevel)) { //查出所有的省
queryWrapper.eq("DISTRICT_LEVEL", districtLevel);
return districtMapper.selectList(queryWrapper);
} else {
queryWrapper.eq("DISTRICT_NAME", districtName); queryWrapper.eq("DISTRICT_NAME", districtName);
ChFndDistrict chFndDistrict = districtMapper.selectOne(queryWrapper);
QueryWrapper<ChFndDistrict> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("IS_VALID", "Y");
queryWrapper2.eq("PARENT_DISTIRCT_CODE", chFndDistrict.getDistrictCode());
return districtMapper.selectList(queryWrapper2);
} }
return districtMapper.selectList(queryWrapper);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment