Commit 412e4bc3 by 陶光胜

返回结果转化

parent 644f8ad0
package com.gic.plug.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.plug.web.vo.CityVO;
import com.gic.plug.web.vo.ProvinceVO;
import com.gic.store.dto.CityDTO;
import com.gic.store.dto.CountyDTO;
import com.gic.store.dto.ProvinceDTO;
......@@ -26,15 +29,15 @@ public class ProvincesController {
switch (type){
case 1:
ServiceResponse<List<ProvinceDTO>> serviceResponse = this.provincesApiService.selectAllProvince();
return RestResponse.success(serviceResponse.getResult());
return RestResponse.success(EntityUtil.changeEntityListByJSON(ProvinceVO.class, serviceResponse.getResult()));
case 2:
ServiceResponse<List<CityDTO>> serviceResponse1 = this.provincesApiService.selectAllCity();
if(serviceResponse1.isSuccess()){
List<CityDTO> list = serviceResponse1.getResult();
List<CityDTO> resultList = new ArrayList<>();
List<CityVO> resultList = new ArrayList<>();
for(CityDTO cityDTO : list){
if(cityDTO.getProvinceId().equals(id)){
resultList.add(cityDTO);
resultList.add(EntityUtil.changeEntityByJSON(CityVO.class, cityDTO));
}
}
return RestResponse.success(resultList);
......@@ -46,7 +49,7 @@ public class ProvincesController {
List<CountyDTO> resultList = new ArrayList<>();
for(CountyDTO countyDTO : list){
if(countyDTO.getCityId().equals(id)){
resultList.add(countyDTO);
resultList.add(EntityUtil.changeEntityByJSON(CountyDTO.class, countyDTO));
}
}
return RestResponse.success(resultList);
......
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