|
@@ -1,15 +1,15 @@
|
|
|
-package com.yonge.cooleshow.tenant.controller.open;
|
|
|
+package com.yonge.cooleshow.tenant.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.microsvc.toolkit.common.response.paging.PageInfo;
|
|
|
import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
-import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.microsvc.toolkit.common.webportal.exception.BizException;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.SysArea;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysAreaService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.SysAreaWrapper;
|
|
|
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.cooleshow.tenant.io.request.SysAreaVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -34,55 +34,55 @@ public class OpenSysAreaController {
|
|
|
@Autowired
|
|
|
private SysAreaService sysAreaService;
|
|
|
|
|
|
- /**
|
|
|
- * 查询单条
|
|
|
- * @param id 详情ID
|
|
|
- * @return R<SysAreaVo.SysArea>
|
|
|
- */
|
|
|
- @ApiOperation(value = "详情", notes = "传入id")
|
|
|
+ /**
|
|
|
+ * 查询单条
|
|
|
+ * @param id 详情ID
|
|
|
+ * @return R<SysAreaVo.SysArea>
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "详情", notes = "传入id")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "long")
|
|
|
})
|
|
|
@GetMapping("/detail/{id}")
|
|
|
- public R<SysAreaWrapper.SysArea> detail(@PathVariable("id") Long id) {
|
|
|
+ public HttpResponseResult<SysAreaWrapper.SysArea> detail(@PathVariable("id") Long id) {
|
|
|
|
|
|
- return R.from(sysAreaService.detail(id));
|
|
|
- }
|
|
|
+ return HttpResponseResult.succeed(sysAreaService.detail(id));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 根据code查询
|
|
|
- * @param code 详情ID
|
|
|
- * @return R<SysAreaVo.SysArea>
|
|
|
- */
|
|
|
- @ApiOperation(value = "根据code查询", notes = "传入code")
|
|
|
+ /**
|
|
|
+ * 根据code查询
|
|
|
+ * @param code 详情ID
|
|
|
+ * @return R<SysAreaVo.SysArea>
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "根据code查询", notes = "传入code")
|
|
|
@GetMapping("/queryByCode/{code}")
|
|
|
- public R<SysArea> queryByCode(@PathVariable("code") Integer code) {
|
|
|
+ public HttpResponseResult<SysArea> queryByCode(@PathVariable("code") Integer code) {
|
|
|
|
|
|
- List<Integer> codeList = new ArrayList<Integer>();
|
|
|
- codeList.add(code);
|
|
|
- List<SysArea> list = sysAreaService.queryByCodes(codeList);
|
|
|
+ List<Integer> codeList = new ArrayList<Integer>();
|
|
|
+ codeList.add(code);
|
|
|
+ List<SysArea> list = sysAreaService.queryByCodes(codeList);
|
|
|
|
|
|
- if(list == null || list.size() == 0){
|
|
|
- throw BizException.from("根据code查询区域表失败");
|
|
|
- }
|
|
|
+ if(list == null || list.size() == 0){
|
|
|
+ throw BizException.from("根据code查询区域表失败");
|
|
|
+ }
|
|
|
|
|
|
- return R.from(list.get(0));
|
|
|
- }
|
|
|
+ return HttpResponseResult.succeed(list.get(0));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 查询分页
|
|
|
- * @param query SysAreaVo.SysAreaQuery
|
|
|
- * @return R<PageInfo<SysAreaVo.SysAreaList>>
|
|
|
- */
|
|
|
+ * 查询分页
|
|
|
+ * @param query SysAreaVo.SysAreaQuery
|
|
|
+ * @return R<PageInfo<SysAreaVo.SysAreaList>>
|
|
|
+ */
|
|
|
@ApiOperation(value = "查询分页", notes = "传入sysAreaSearch")
|
|
|
@PreAuthorize("@auditsvc.hasPermissions('sysArea/page', {'BACKEND'})")
|
|
|
@PostMapping("/page")
|
|
|
- public R<PageInfo<SysAreaWrapper.SysArea>> page(@RequestBody SysAreaWrapper.SysAreaQuery query) {
|
|
|
+ public HttpResponseResult<PageInfo<SysAreaWrapper.SysArea>> page(@RequestBody SysAreaWrapper.SysAreaQuery query) {
|
|
|
|
|
|
IPage<SysAreaWrapper.SysArea> pages = sysAreaService.selectPage(QueryInfo.getPage(query), query);
|
|
|
|
|
|
- return R.from(QueryInfo.pageInfo(pages));
|
|
|
- }
|
|
|
+ return HttpResponseResult.succeed(QueryInfo.pageInfo(pages));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询全部区域
|
|
@@ -90,21 +90,21 @@ public class OpenSysAreaController {
|
|
|
*/
|
|
|
@ApiOperation(value = "查询全部区域", notes = "查询全部区域")
|
|
|
@GetMapping("/queryAllProvince")
|
|
|
- public R<List<SysAreaVo.Province>> queryAllProvince() {
|
|
|
+ public HttpResponseResult<List<SysAreaVo.Province>> queryAllProvince() {
|
|
|
|
|
|
List<SysAreaVo.Province> provinces = Lists.newArrayList();
|
|
|
|
|
|
// 全部城市信息
|
|
|
Map<Integer, List<SysArea>> areaMap = sysAreaService.lambdaQuery().list().stream()
|
|
|
- .filter(x -> x.getDelFlag().equals("0"))
|
|
|
- .collect(Collectors.groupingBy(SysArea::getParentOrganId));
|
|
|
+ .filter(x -> x.getDelFlag().equals("0"))
|
|
|
+ .collect(Collectors.groupingBy(SysArea::getParentOrganId));
|
|
|
|
|
|
SysAreaVo.Province provinceVo;
|
|
|
SysAreaVo.City cityVo;
|
|
|
for (SysArea province : areaMap.get(0)) {
|
|
|
|
|
|
provinceVo = JSON.parseObject(JSON.toJSONString(province), SysAreaVo.Province.class)
|
|
|
- .cities(Lists.newArrayList());
|
|
|
+ .cities(Lists.newArrayList());
|
|
|
provinces.add(provinceVo);
|
|
|
|
|
|
// 城市信息
|
|
@@ -119,6 +119,6 @@ public class OpenSysAreaController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return R.from(provinces);
|
|
|
+ return HttpResponseResult.succeed(provinces);
|
|
|
}
|
|
|
}
|