李雨欣 9.7测试接口

master
liyuxin 2024-09-07 10:24:17 +08:00
parent 248ffd188a
commit e576e9cc00
15 changed files with 111 additions and 146 deletions

View File

@ -18,46 +18,51 @@ import java.util.Date;
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "market_apis",autoResultMap = true)
@TableName(value = "market_msg",autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class Apis extends BaseEntity {
public class Msg extends BaseEntity {
/**
* ID
*/
@TableId(value = "api_id",type = IdType.AUTO)
private Long apiId;
@TableId(value = "msg_id",type = IdType.AUTO)
private Long msgId;
/**
*
*
*/
@Schema(type = "String",description = "接口地址")
private String apiAddr;
@Schema(type = "String",description = "姓名")
private String name;
/**
*
*
*/
@Schema(type = "String",description = "请求方式")
private String requestWay;
@Schema(type = "String",description = "必填")
private String required;
/**
*
*/
@Schema(type = "String",description = "请求类型")
private String type;
/**
* get/post
*/
@Schema(type = "String",description = "请求方式")
private String most;
/**
*
*/
@Schema(type = "String",description = "接口描述")
private String apiDesc;
@Schema(type = "String",description = "请求参数说明")
private String desc;
/**
*
*/
@Schema(type = "Long",description = "请求参数说明")
private Long requestId;
@Schema(type = "Long",description = "所对应")
private Long apiId;
/**
* JSON
*/
@Schema(type = "String",description = "JSON返回示例")
private String jsonSuch;
private Date updateTime;

View File

@ -74,6 +74,11 @@ public class Myapi extends BaseEntity{
*/
@Schema(description = "API类型",type = "String")
private String type;
/*
API
*/
@Schema(description = "API返回报文",type = "String")
private String msgresp;
private String createBy;
private Date createTime;
@ -93,6 +98,7 @@ public class Myapi extends BaseEntity{
.mode( myapiSaveReq.getMode())
.auth( myapiSaveReq.getAuth() )
.type( myapiSaveReq.getType())
.msgresp(myapiSaveReq.getMsgresp())
.build();
}
@ -111,6 +117,7 @@ public class Myapi extends BaseEntity{
.mode( myapiUpdReq.getMode())
.auth( myapiUpdReq.getAuth() )
.type( myapiUpdReq.getType())
.msgresp(myapiUpdReq.getMsgresp())
.build();
}

View File

@ -70,6 +70,10 @@ public class MyapiListReq {
@Schema(description = "API类型",type = "String")
private String type;
/*
API
*/
@Schema(description = "API返回报文",type = "String")
private String msgresp;
}

View File

@ -70,7 +70,11 @@ public class MyapiSaveReq {
@Schema(description = "API类型",type = "String")
private String type;
/*
API
*/
@Schema(description = "API返回报文",type = "String")
private String msgresp;

View File

@ -69,7 +69,11 @@ public class MyapiUpdReq {
*/
@Schema(description = "API类型",type = "String")
private String type;
/*
API
*/
@Schema(description = "API返回报文",type = "String")
private String msgresp;

View File

@ -70,7 +70,11 @@ public class MyapiListResp {
*/
@Schema(description = "API类型",type = "String")
private String type;
/*
API
*/
@Schema(description = "API返回报文",type = "String")
private String msgresp;
private String createBy;
private Date createTime;
@ -94,6 +98,7 @@ public class MyapiListResp {
.mode( myapi.getMode())
.auth( myapi.getAuth())
.type( myapi.getType())
.msgresp( myapi.getMsgresp() )
.build();
}

View File

@ -1,84 +0,0 @@
package com.muyu.market.admain.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Tag(name = "商品添加", description = "商品添加")
public class MyapiSaveResp {
/**
* ID
*/
@TableId(value = "api_id",type = IdType.AUTO)
private Long apiId;
/**
*
*/
@Schema(type = "String",description = "接口名称")
private String name;
/**
*
*/
@Schema(description = "价钱/次",type = "BigDecimal")
private BigDecimal price;
/**
*
*/
@Schema(type = "String",description = "介绍")
private String test;
/**
*
*/
@Schema(description = "商品描述",type = "String")
private String data;
/**
*
*/
@Schema(description = "接口名称",type = "String")
private String apiName;
/**
*
*/
@Schema(description = "接口地址",type = "String")
private String ip;
/**
*
*/
@Schema(description = "请求方式",type = "String")
private String mode;
/**
*
*/
@Schema(description = "购买字段(当修改成功触发)",type = "Integer")
private int auth;
/*
API
*/
@Schema(description = "API类型",type = "String")
private String type;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private String remark;
}

View File

@ -1,9 +1,8 @@
package com.muyu.market.server.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.market.admain.Apis;
import com.muyu.market.admain.Myapi;
import com.muyu.market.server.service.ApisService;
import com.muyu.market.admain.Msg;
import com.muyu.market.server.service.MsgService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@ -15,23 +14,25 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/apis")
@Tag(name = "api接口文档展示控制层",description = "api接口文档展示控制层")
@RequestMapping("/msg")
@Tag(name = "msg接口文档展示控制层",description = "msg接口文档展示控制层")
@RequiredArgsConstructor
public class ApisController {
public class MsgController {
@Autowired
private ApisService apisService;
private MsgService msgService;
@PostMapping("/selectByApisId")
@Operation(summary = "api接口文档查询展示",description = "根据ID查询接口文档展示")
public Result<Apis> selectByApisId(@Validated @RequestParam( value = "apiId") Long apiId){
Apis byId = apisService.getById(apiId);
return Result.success(byId,"操作成功");
@PostMapping("/findMsgByApiId")
@Operation(summary = "msg接口文档查询展示",description = "根据ID查询接口文档展示")
public Result<List<Msg>> selectByApisId(@Validated @RequestParam( value = "apiId") Integer apiId){
List<Msg> msgByApiId = msgService.findMsgByApiId( apiId );
return Result.success(msgByApiId,"操作成功");
}

View File

@ -1,9 +0,0 @@
package com.muyu.market.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.market.admain.Apis;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ApisMapper extends BaseMapper<Apis> {
}

View File

@ -0,0 +1,15 @@
package com.muyu.market.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.market.admain.Msg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface MsgMapper extends BaseMapper<Msg> {
@Select( "SELECT * from market_msg WHERE api_id = #{apiId}" )
List<Msg> findMsgByApiId(@Param( "apiId" )Integer apiId);
}

View File

@ -1,8 +0,0 @@
package com.muyu.market.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.market.admain.Apis;
public interface ApisService extends IService<Apis> {
}

View File

@ -1,11 +0,0 @@
package com.muyu.market.server.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.market.admain.Apis;
import com.muyu.market.server.mapper.ApisMapper;
import com.muyu.market.server.service.ApisService;
import org.springframework.stereotype.Service;
@Service
public class ApisServiceImpl extends ServiceImpl<ApisMapper, Apis> implements ApisService {
}

View File

@ -0,0 +1,20 @@
package com.muyu.market.server.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.market.admain.Msg;
import com.muyu.market.server.mapper.MsgMapper;
import com.muyu.market.server.service.MsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MsgServiceImpl extends ServiceImpl<MsgMapper, Msg> implements MsgService {
@Autowired
private MsgMapper msgMapper;
@Override
public List<Msg> findMsgByApiId(Integer apiId) {
return msgMapper.findMsgByApiId( apiId );
}
}

View File

@ -0,0 +1,12 @@
package com.muyu.market.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.market.admain.Msg;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MsgService extends IService<Msg> {
List<Msg> findMsgByApiId(Integer apiId);
}

View File

@ -48,8 +48,8 @@ public class SelectPhoneUtil {
System.out.printf("运营商:%s%n", result.getString("company"));
// 设置编码(仅在需要时启用)
try {
System.setOut(new java.io.PrintStream(System.out,true,"UTF-8"));
} catch (java.io.UnsupportedEncodingException e) {
System.setOut(new PrintStream(System.out,true,"UTF-8"));
} catch (UnsupportedEncodingException e) {
System.err.println("无法设置UTF-8编码" + e.getMessage());
}
selectByPhone.setCompany(result.getString("company"));