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

省市区查询接口修改

parent 411ebbeb
......@@ -31,7 +31,7 @@ public class DisableController {
* 省市区
*
* @param districtLevel 区域级别:1省2地级市3县
* @param districtName 上级区域代码
* @param districtName 上级区域
*/
@RequestMapping("/district")
public Result<List<ChFndDistrict>> district(String districtLevel, String districtName) {
......@@ -79,7 +79,7 @@ public class DisableController {
* @param realName 失能人员姓名
* @param certiCode 失能人员身份证号码
* @param dataFrom 申请来源
* @param srvOrganId 护理机构
* @param srvOrganName 护理机构名称
* @param pageNum 当前页
* @param pageSize 每页几条数据
* @return 失能人员信息列表
......
......@@ -52,7 +52,7 @@ public interface DisableService {
* 省市区
*
* @param districtLevel 区域级别:1省2地级市3县
* @param districtName 上级区域代码
* @param districtName 上级区域
*/
List<ChFndDistrict> district(String districtLevel, String districtName);
......
......@@ -97,26 +97,40 @@ public class DisableServiceImpl implements DisableService {
@Override
public List<ChFndDistrict> district(String districtLevel, String districtName) {
if ("4".equals(districtLevel)) {
QueryWrapper<ChFndStreet> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("STREET_NAME", districtName);
queryWrapper.eq("IS_VALID", 0);
List<ChFndStreet> fndStreets = fndStreetMapper.selectList(queryWrapper);
//查询区代码
QueryWrapper<ChFndDistrict> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("IS_VALID", "Y");
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<>();
for (ChFndStreet chFndStreet : fndStreets) {
ChFndDistrict chFndDistrict = new ChFndDistrict();
chFndDistrict.setDistrictCode(chFndStreet.getStreetCode());
chFndDistrict.setDistrictName(chFndStreet.getStreetName());
chFndDistrict.setParentDistirctCode(chFndStreet.getAreaCode());
ChFndDistrict chFndDistrict1 = new ChFndDistrict();
chFndDistrict1.setDistrictCode(chFndStreet.getStreetCode());
chFndDistrict1.setDistrictName(chFndStreet.getStreetName());
chFndDistrict1.setParentDistirctCode(chFndStreet.getAreaCode());
resuts.add(chFndDistrict1);
}
return resuts;
} else {
QueryWrapper<ChFndDistrict> queryWrapper = new QueryWrapper<>();
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);
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