Skip to content

Web通信配置

配置时间转换规则、配置knife4j文档规则、重新封装knife4j注解。

Maven坐标

xml
<dependency>
    <groupId>com.ikingtech.framework</groupId>
    <artifactId>sdk-web</artifactId>
</dependency>

用法

  • 接口文档类注解

方法名方法释义
ApiController控制整个类生成接口信息的内容
  • 接口文档方法注解

方法名方法释义
GetRequestget请求方法说明
PostRequestpost请求方法说明
PutRequestput请求方法说明
DeleteRequestdelete请求方法说明

示例

java
@ApiController(value = "/item", name = "数据管理-事项管理", description = "数据管理-事项管理")
public class ItemController {

    @PutRequest(order = 1, value = "/add", summary = "添加事项管理", description = "添加事项管理")
    R<String> add(@Validated @RequestBody ItemDTO itemDTO) {
        return R.ok();
    }

    @DeleteRequest(order = 2, value = "/delete/{id}", summary = "删除事项管理", description = "删除事项管理")
    R<String> delete(@PathVariable String id) {
        return R.ok();
    }

    @PostRequest(order = 3, value = "/update", summary = "更新事项管理", description = "更新事项管理")
    R<String> update(@Validated(ItemDTO.Update.class) @RequestBody ItemDTO itemDTO) {
        return R.ok();
    }

    @PostRequest(order = 4, value = "/list", summary = "查询事项管理列表", description = "查询事项管理列表")
    public R<List<ItemDTO>> list(@RequestBody ItemQueryParamDTO itemQueryParamDTO) {
        return R.ok();
    }

    @GetRequest(order = 5, value = "/detail/{id}", summary = "查询事项详情", description = "查询事项详情")
    public R<ItemDetailVO> detail(@PathVariable String id) {
        return R.ok();
    }

    @PostRequest(order = 6, value = "/start/{id}", summary = "启用", description = "启用")
    public R<Object> start(@PathVariable String id) {
        return R.ok();
    }

    @PostRequest(order = 7, value = "/stop/{id}", summary = "停用", description = "停用")
    public R<Object> stop(@PathVariable String id) {
        return R.ok();
    }

}