|
@@ -1,7 +1,10 @@
|
|
|
package com.pavis.app.saasbacken.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.pavis.app.saasbacken.aop.PreSaveLog;
|
|
|
+import com.pavis.app.saasbacken.dao.ProvinceCityDistrictMapper;
|
|
|
+import com.pavis.app.saasbacken.entity.ProvinceCityDistrict;
|
|
|
import com.pavis.app.saasbacken.exception.GlobalExceptionHandler;
|
|
|
import com.pavis.app.saasbacken.form.ModuleTree;
|
|
|
import com.pavis.app.saasbacken.http.ResultBody;
|
|
@@ -14,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -163,10 +167,36 @@ public class CommonController {
|
|
|
String uri = request.getRequestURI();
|
|
|
try {
|
|
|
log.info("getNodeData:{}", resType);
|
|
|
- // return ResultBody.ok().path(uri).data(null);
|
|
|
return ResultBody.ok().path(uri).data(checkModuleService.getNodeData(resType));
|
|
|
} catch (Exception e) {
|
|
|
return GlobalExceptionHandler.resolveException(e, uri);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProvinceCityDistrictMapper provinceCityDistrictMapper;
|
|
|
+
|
|
|
+ @PostMapping("/province/get")
|
|
|
+ // @ResponseBody
|
|
|
+ @PreSaveLog("省市级联动")
|
|
|
+ @ApiOperation(value = "获取省市级联动接口", notes = "获取省市级联动接口")
|
|
|
+ public ResultBody getPCD(Integer pid) throws IOException {
|
|
|
+ // response.setContentType("text/xml;Charset=UTF-8");
|
|
|
+ // int pid = Integer.parseInt(request.getParameter("pid"));
|
|
|
+ // List<ProvinceCityDistrict> pcdList = provinceCityDistrictMapper.findPCDByPid(pid);
|
|
|
+ List<ProvinceCityDistrict> pcdList = provinceCityDistrictMapper.selectList(new QueryWrapper<ProvinceCityDistrict>().lambda().eq(ProvinceCityDistrict::getPid,pid));
|
|
|
+ // String json = JSON.toJSONString(pcdList);
|
|
|
+ // response.getWriter().write(json);
|
|
|
+
|
|
|
+ HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
|
|
+ String uri = request.getRequestURI();
|
|
|
+ try {
|
|
|
+ log.info("getPCD:{}", pid);
|
|
|
+ // return ResultBody.ok().path(uri).data(null);
|
|
|
+ return ResultBody.ok().path(uri).data(pcdList);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return GlobalExceptionHandler.resolveException(e, uri);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|