临时区域接口
This commit is contained in:
parent
444c532f9a
commit
8b7ab3c6fe
|
|
@ -5,6 +5,7 @@ import com.ghy.common.constant.UserConstants;
|
|||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.json.JSONObject;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.system.domain.SysArea;
|
||||
import com.ghy.system.service.ISysAreaService;
|
||||
|
|
@ -15,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -45,6 +47,43 @@ public class SysAreaController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
@PostMapping("/app/all")
|
||||
@ResponseBody
|
||||
public Object appAll(@RequestBody SysArea sysArea)
|
||||
{
|
||||
try {
|
||||
// 第一层 省
|
||||
List<SysArea> provinceAreas = sysAreaService.selectSysAreaList(sysArea);
|
||||
for (SysArea provinceArea : provinceAreas) {
|
||||
logger.info("进行中的省 : " + provinceArea.getAreaName());
|
||||
SysArea param1 = new SysArea();
|
||||
param1.setParentCode(provinceArea.getAreaCode());
|
||||
// 第二层 市
|
||||
List<SysArea> cityAreas = sysAreaService.selectSysAreaList(param1);
|
||||
for (SysArea cityArea : cityAreas){
|
||||
SysArea param2 = new SysArea();
|
||||
param2.setParentCode(cityArea.getAreaCode());
|
||||
// 第三层 区
|
||||
List<SysArea> countryAreas = sysAreaService.selectSysAreaList(param2);
|
||||
for (SysArea countryArea : countryAreas){
|
||||
SysArea param3 = new SysArea();
|
||||
param3.setParentCode(countryArea.getAreaCode());
|
||||
// 第三层 街道
|
||||
List<SysArea> streetAreas = sysAreaService.selectSysAreaList(param3);
|
||||
countryArea.setChild(streetAreas);
|
||||
}
|
||||
cityArea.setChild(countryAreas);
|
||||
}
|
||||
provinceArea.setChild(cityAreas);
|
||||
}
|
||||
return provinceAreas;
|
||||
}catch (Exception e){
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public AjaxResult appList(@RequestBody SysArea sysArea)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.ghy.common.annotation.Excel;
|
|||
import com.ghy.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
* 区域表
|
||||
|
|
@ -49,4 +51,6 @@ public class SysArea extends BaseEntity {
|
|||
@Excel(name = "纬度", cellType = Excel.ColumnType.STRING)
|
||||
private String lat;
|
||||
|
||||
private List<SysArea> child;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue