Commit 69fa602e authored by ysongq's avatar ysongq

commit

parent 6e296055
......@@ -44,7 +44,10 @@ public class DataGoodsApiController extends BaseController {
public Result<List<DataGoodsApiDto>> findById(@PathVariable(value = "id") Long id) {
if (id != null) {
Result result = tDataGoodsApiService.selectById(id);
return new Result(true, "查询商品详情成功!", StatusCode.OK, result);
result.getMessage();
result.getCode();
result.getData();
return result;
}
return new Result<>(false, "查询商品详情失败!",StatusCode.ERROR);
}
......
......@@ -161,7 +161,7 @@ public class DataGoodsApiDto implements Serializable {
@ApiModelProperty(value = "api请求样例")
private String requestExample;
@ApiModelProperty(value = "公共参数数字")
@ApiModelProperty(value = "参数分类数字")
private String paramsDiffNum;
......
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataDetailsDto;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.dm.mall.moduls.mapper.DataGoodsApiDao;
import com.jz.dm.mall.moduls.service.DataGoodsApiService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -36,11 +40,13 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
@Override
public Result selectById(Long id) {
List<DataGoodsApiDto> dataGoodsApiDto = tDataGoodsApiDao.selectById(id);
if (dataGoodsApiDto.size() == 0) {
return Result.error(StatusCode.ERROR, "查询异常!");
}
List<DataGoodsApiDto> list1 = new ArrayList<>();
List<DataGoodsApiDto> list2 = new ArrayList<>();
List<DataGoodsApiDto> list3 = new ArrayList<>();
List<DataGoodsApiDto> list4 = new ArrayList<>();
List<DataGoodsApiDto> list5 = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
for (DataGoodsApiDto goodsApiDto : dataGoodsApiDto) {
if (goodsApiDto.getParamsDiffNum().equals("01")) {
......@@ -52,15 +58,13 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
if (goodsApiDto.getParamsDiffNum().equals("03")) {
list3.add(goodsApiDto);
}
if (goodsApiDto.getParamsDiffNum().equals("04")) {
list4.add(goodsApiDto);
if (!StringUtils.isEmpty(goodsApiDto.getRequestExample())) {
map.put("requestExample", goodsApiDto.getRequestExample()); // 请求示例
}
if (goodsApiDto.getParamsDiffNum().equals("05")) {
list5.add(goodsApiDto);
if (!StringUtils.isEmpty(goodsApiDto.getReturnDataExample())) {
map.put("returnDataExample", goodsApiDto.getReturnDataExample()); // 响应示例
}
}
Map<String, Object> map = new HashMap<>();
// 商品详情
DataGoodsApiDto goods = dataGoodsApiDto.get(0);
DataDetailsDto data = new DataDetailsDto();
......@@ -81,10 +85,11 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
map.put("pubParam", list1); // 公共参数
map.put("reqParam", list2); // 请求参数
map.put("resParam", list3); // 响应参数
map.put("reqExaParam", list4); // 请求示例
map.put("resExaParam", list5); // 响应示例
Result result = new Result();
result.setData(map);
return result;
return Result.of_success(ResultMsg.SUCCESS, result);
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletRequest;
*/
@RestController
@RequestMapping("department")
@Api(tags = "企业api")
@Api(tags = "企业信息管理--controller")
public class DepartmentController extends BaseController {
/**
* 服务对象
......
......@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* api商品(TDataGoodsApi)表控制层
*
......@@ -35,11 +37,11 @@ public class DataGoodsApiController extends BaseController {
*/
@GetMapping("/getDataDetails/{id}")
@ApiOperation(value = "点击商品查看商品详情", notes = "api商品")
public Result<DataGoodsApiDto> findById(@PathVariable(value = "id") Long id) throws Exception{
public Result<List<DataGoodsApiDto>> findById(@PathVariable(value = "id") Long id) throws Exception{
if (id != null) {
Result<DataGoodsApiDto> result = new Result<>();
DataGoodsApiDto dataGoodsApi = tDataGoodsApiService.selectById(id);
return new Result<DataGoodsApiDto>(true, "查询商品详情成功!", StatusCode.OK, dataGoodsApi);
// DataGoodsApiDto dataGoodsApi = tDataGoodsApiService.selectById(id);
// return new Result(true, "查询商品详情成功!", StatusCode.OK, dataGoodsApi);
}
return new Result<>(false, "查询商品详情失败!", StatusCode.ERROR);
}
......
......@@ -68,6 +68,17 @@ public class DataGoodsApiDto {
@ApiModelProperty(value = "api返回数据样例")
private String returnDataExample;
@ApiModelProperty(value = "参数分类数字")
private String paramsDiffNum;
public String getParamsDiffNum() {
return paramsDiffNum;
}
public void setParamsDiffNum(String paramsDiffNum) {
this.paramsDiffNum = paramsDiffNum;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
......
......@@ -5,6 +5,8 @@ import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.entity.DataGoodsApi;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* api商品(TDataGoodsApi)表数据库访问层
*
......@@ -19,5 +21,5 @@ public interface DataGoodsApiDao extends BaseMapper<DataGoodsApi> {
* @param id
* @return
*/
DataGoodsApiDto findById(@Param("dataGoodsId") Long id);
List<DataGoodsApiDto> findById(@Param("dataGoodsId") Long id);
}
\ No newline at end of file
package com.jz.manage.moduls.service;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.common.utils.Result;
/**
* api商品(TDataGoodsApi)表服务接口
......@@ -15,5 +16,5 @@ public interface DataGoodsApiService {
* @param id
* @return
*/
DataGoodsApiDto selectById(Long id) throws Exception;
Result selectById(Long id) throws Exception;
}
\ No newline at end of file
package com.jz.manage.moduls.service.impl;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.mapper.DataGoodsApiDao;
import com.jz.manage.moduls.service.DataGoodsApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* api商品(TDataGoodsApi)表服务实现类
*
......@@ -24,8 +31,37 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
* @return
*/
@Override
public DataGoodsApiDto selectById(Long id) {
DataGoodsApiDto dataGoodsApiDto = tDataGoodsApiDao.findById(id);
return dataGoodsApiDto;
public Result selectById(Long id) {
List<DataGoodsApiDto> dataGoodsApiDto = tDataGoodsApiDao.findById(id);
if (dataGoodsApiDto.size() == 0) {
return Result.error(StatusCode.ERROR, "查询异常!");
}
// 基本信息
List<DataGoodsApiDto> list1 = new ArrayList<>();
List<DataGoodsApiDto> list2 = new ArrayList<>();
List<DataGoodsApiDto> list3 = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
// for (DataGoodsApiDto goodsApiDto : dataGoodsApiDto) {
// if (goodsApiDto.getParamsDiffNum().equals("01")) {
// list1.add(goodsApiDto);
// }
// if (goodsApiDto.getParamsDiffNum().equals("02")) {
// list2.add(goodsApiDto);
// }
// if (goodsApiDto.getParamsDiffNum().equals("03")) {
// list3.add(goodsApiDto);
// }
// if (goodsApiDto.getParamsDiffNum().equals("04")) {
// String requestExample = goodsApiDto.getRequestExample();
// map.put("requestExample", requestExample); // 请求示例
// }
// if (goodsApiDto.getParamsDiffNum().equals("05")) {
// String returnDataExample = goodsApiDto.getReturnDataExample();
// map.put("returnDataExample", returnDataExample); // 响应示例
// }
// }
return null;
}
}
\ No newline at end of file
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