Commit 759b51d0 authored by ysongq's avatar ysongq

主键查询数据详情

parent be2762d5
...@@ -7,8 +7,8 @@ package com.jz.common.utils; ...@@ -7,8 +7,8 @@ package com.jz.common.utils;
* @Version: * @Version:
*/ */
public class StatusCode { public class StatusCode {
public static final int OK = 30000; // 成功 public static final int OK = 200; // 成功
public static final int ERROR = 30001; // 失败 public static final int ERROR = 201; // 失败
public static final int LOGINERROR = 30002; // 用户名或密码错误 public static final int LOGINERROR = 30002; // 用户名或密码错误
public static final int ACCESSERROR = 30003; // 权限不足 public static final int ACCESSERROR = 30003; // 权限不足
} }
package com.jz.manage.moduls.controller.goods; package com.jz.manage.moduls.controller.goods;
import com.jz.common.entity.DataGoods;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.BaseController; import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.service.DataGoodsApiService; import com.jz.manage.moduls.service.DataGoodsApiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -21,5 +28,19 @@ public class DataGoodsApiController extends BaseController { ...@@ -21,5 +28,19 @@ public class DataGoodsApiController extends BaseController {
@Autowired @Autowired
private DataGoodsApiService tDataGoodsApiService; private DataGoodsApiService tDataGoodsApiService;
/**
* 根据主键查询商品详情-api
* @param id
* @return
*/
@GetMapping("/{id}")
@ApiOperation(value = "点击商品查看商品详情", notes = "api商品")
public Result<DataGoodsApiDto> findById(@PathVariable(value = "id") Long id) {
if (id != null) {
Result<DataGoodsApiDto> result = new Result<>();
DataGoodsApiDto dataGoodsApi = tDataGoodsApiService.selectById(id);
return new Result<DataGoodsApiDto>(true, "查询商品详情成功!", StatusCode.OK, dataGoodsApi);
}
return new Result<>(false, "查询商品详情失败!");
}
} }
\ No newline at end of file
package com.jz.manage.moduls.controller.goods.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/14
* @Version:
*/
@ApiModel("数据管理-数据详情参数")
public class DataGoodsApiDto {
@ApiModelProperty(value = "数据id")
private Long dataGoodsId;
@ApiModelProperty(value = "商品分类名称")
private String categoryName;
@ApiModelProperty(value = "数据商品名称")
private String dataName;
@ApiModelProperty(value = "数据类型")
private String dataType;
@ApiModelProperty(value = "价格类型")
private String priceType;
@ApiModelProperty(value = "更新时间")
private Date uptTime;
@ApiModelProperty(value = "接口地址")
private String apiUrl;
@ApiModelProperty(value = "接口方法")
private String apiMethod;
@ApiModelProperty(value = "请求方式")
private String requestType;
@ApiModelProperty(value = "返回类型")
private String returnType;
@ApiModelProperty(value = "apiKey")
private String apiKey;
@ApiModelProperty(value = "token")
private String requestToken;
@ApiModelProperty(value = "参数分类")
private String paramsDiff;
@ApiModelProperty(value = "参数名称")
private String paramsName;
@ApiModelProperty(value = "参数值")
private String defaultValue;
@ApiModelProperty(value = "参数描述")
private String paramsDesc;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "api返回数据样例")
private String returnDataExample;
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getApiMethod() {
return apiMethod;
}
public void setApiMethod(String apiMethod) {
this.apiMethod = apiMethod;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getRequestToken() {
return requestToken;
}
public void setRequestToken(String requestToken) {
this.requestToken = requestToken;
}
public String getParamsDiff() {
return paramsDiff;
}
public void setParamsDiff(String paramsDiff) {
this.paramsDiff = paramsDiff;
}
public String getParamsName() {
return paramsName;
}
public void setParamsName(String paramsName) {
this.paramsName = paramsName;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public String getReturnDataExample() {
return returnDataExample;
}
public void setReturnDataExample(String returnDataExample) {
this.returnDataExample = returnDataExample;
}
public String getParamsDesc() {
return paramsDesc;
}
public void setParamsDesc(String paramsDesc) {
this.paramsDesc = paramsDesc;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package com.jz.manage.moduls.mapper; package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.entity.DataGoodsApi; import com.jz.manage.moduls.entity.DataGoodsApi;
/** /**
...@@ -12,5 +13,10 @@ import com.jz.manage.moduls.entity.DataGoodsApi; ...@@ -12,5 +13,10 @@ import com.jz.manage.moduls.entity.DataGoodsApi;
public interface DataGoodsApiDao extends BaseMapper<DataGoodsApi> { public interface DataGoodsApiDao extends BaseMapper<DataGoodsApi> {
/**
* 主键查询数据商品
* @param id
* @return
*/
DataGoodsApiDto findById(Long id);
} }
\ No newline at end of file
package com.jz.manage.moduls.service; package com.jz.manage.moduls.service;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
/** /**
* api商品(TDataGoodsApi)表服务接口 * api商品(TDataGoodsApi)表服务接口
* *
...@@ -8,5 +10,10 @@ package com.jz.manage.moduls.service; ...@@ -8,5 +10,10 @@ package com.jz.manage.moduls.service;
*/ */
public interface DataGoodsApiService { public interface DataGoodsApiService {
/**
* 主键查询数据详情
* @param id
* @return
*/
DataGoodsApiDto selectById(Long id);
} }
\ No newline at end of file
package com.jz.manage.moduls.service.impl; package com.jz.manage.moduls.service.impl;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.manage.moduls.mapper.DataGoodsApiDao; import com.jz.manage.moduls.mapper.DataGoodsApiDao;
import com.jz.manage.moduls.service.DataGoodsApiService; import com.jz.manage.moduls.service.DataGoodsApiService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -16,4 +17,15 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService { ...@@ -16,4 +17,15 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
@Autowired @Autowired
private DataGoodsApiDao tDataGoodsApiDao; private DataGoodsApiDao tDataGoodsApiDao;
/**
* 主键查询数据详情
*
* @param id
* @return
*/
@Override
public DataGoodsApiDto selectById(Long id) {
DataGoodsApiDto dataGoodsApiDto = tDataGoodsApiDao.findById(id);
return dataGoodsApiDto;
}
} }
\ No newline at end of file
...@@ -22,5 +22,44 @@ ...@@ -22,5 +22,44 @@
</resultMap> </resultMap>
<select id="findById" resultType="com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsApiDto" parameterType="map">
SELECT
t1.data_goods_id as dataGoodsId,
t1.data_name as dataName,
(CASE WHEN t1.data_type = '01' then 'api'
WHEN t1.data_type = '02' then '数据包' end) dataType,
t2.category_name as categoryName,
t1.upt_time as uptTime,
(CASE WHEN t1.data_status = '01' then '预售'
WHEN t1.data_status = '02' then '在售中'
WHEN t1.data_status = '02' then '下架'
WHEN t1.data_status = '02' then '上架' end) dataStatus,
(CASE WHEN t1.price_type = '01' THEN '免费'
WHEN t1.price_type = '02' THEN '收费' end) priceType,
t3.api_url as apiUrl,
t3.api_method as apiMethod,
t3.request_type as requestType,
t3.return_type as returnType,
t3.api_key as apiKey,
t3.request_token as requestToken,
(CASE WHEN t4.params_diff = '01' THEN '公共参数'
WHEN t4.params_diff = '02' THEN '请求参数'
WHEN t4.params_diff = '03' THEN '响应参数'
WHEN t4.params_diff = '04' THEN '请求头参数'
WHEN t4.params_diff = '05' THEN '状态码参数' end) paramsDiff,
t4.params_name as paramsName,
t4.default_value as defaultValue,
t4.params_desc as paramsDesc,
t4.remark as remark,
t3.return_data_example as returnDataExample
FROM
t_data_goods t1
INNER JOIN t_data_goods_category t2 ON t1.category_id = t2.category_id
INNER JOIN t_data_goods_api t3 ON t1.data_goods_id = t3.data_goods_id
INNER JOIN t_data_goods_api_params t4 ON t3.goods_api = t4.goods_api
WHERE
1= 1 AND
t1.del_flag = 'N'
<if test="dataGoodsId != null"> and t1.data_goods_id = #{dataGoodsId}</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
<if test="dataStatus != null and dataStatus != ''"> <if test="dataStatus != null and dataStatus != ''">
and data_status = #{dataStatus} and data_status = #{dataStatus}
</if> </if>
order by t1.upt_time desc
</select> </select>
<!--新增所有列--> <!--新增所有列-->
......
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