Commit ef35093a authored by zengtianlai3's avatar zengtianlai3

添加Knif4j接口文档

parent 84d2b00d
...@@ -68,11 +68,12 @@ public class ApplyController { ...@@ -68,11 +68,12 @@ public class ApplyController {
@ApiOperation(value = "获取应用列表接口", notes = "用于获取应用列表") @ApiOperation(value = "获取应用列表接口", notes = "用于获取应用列表")
@GetMapping("list") @GetMapping("list")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "当前页",value = "当前在第几页", required = true), @ApiImplicitParam(name = "pageNo",value = "当前在第几页", required = true, dataType = "int"),
@ApiImplicitParam(name = "每页数量",value = "每页显示多少页", required = true), @ApiImplicitParam(name = "pageSize",value = "每页显示多少页", required = true, dataType = "int"),
@ApiImplicitParam(name = "应用名",value = "应用名", required = false) @ApiImplicitParam(name = "appName",value = "应用名")
}) })
public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, @RequestParam(value = "pageSize", defaultValue = "0") int pageSize, public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "0") int pageSize,
@RequestParam(value = "appName",required = false) String appName) { @RequestParam(value = "appName",required = false) String appName) {
PageInfoModel<AppVo> records = applyService.getAppList(pageNo,pageSize,appName); PageInfoModel<AppVo> records = applyService.getAppList(pageNo,pageSize,appName);
int total = records.getTotal(); int total = records.getTotal();
......
...@@ -6,6 +6,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; ...@@ -6,6 +6,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter; import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters; import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
...@@ -65,6 +67,12 @@ public class DeviceController { ...@@ -65,6 +67,12 @@ public class DeviceController {
*/ */
@ApiOperation(value = "获取设备列表接口", notes = "用于获取设备列表") @ApiOperation(value = "获取设备列表接口", notes = "用于获取设备列表")
@GetMapping("list") @GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo",value = "当前在第几页", required = true, dataType="int"),
@ApiImplicitParam(name = "pageSize",value = "每页显示多少页", required = true, dataType="int"),
@ApiImplicitParam(name = "appName",value = "应用名"),
@ApiImplicitParam(name = "userName",value = "用户名")
})
public PageResult getDeviceList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public PageResult getDeviceList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "0") int pageSize, @RequestParam(value = "pageSize", defaultValue = "0") int pageSize,
@RequestParam(value = "appName",required = false) String appName, @RequestParam(value = "appName",required = false) String appName,
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.jwt.JwtUtil; import iot.sixiang.license.jwt.JwtUtil;
import iot.sixiang.license.jwt.LoginUser; import iot.sixiang.license.jwt.LoginUser;
...@@ -36,6 +38,10 @@ public class LoginController { ...@@ -36,6 +38,10 @@ public class LoginController {
*/ */
@ApiOperation(value = "登录接口", notes = "登录接口") @ApiOperation(value = "登录接口", notes = "登录接口")
@GetMapping("login") @GetMapping("login")
@ApiImplicitParams({
@ApiImplicitParam(name = "userName",value = "用户名",required = true),
@ApiImplicitParam(name = "password",value = "密码",required = true)
})
public ResResult login(@RequestParam("userName") String userName, @RequestParam("password") String password) { public ResResult login(@RequestParam("userName") String userName, @RequestParam("password") String password) {
...@@ -54,6 +60,10 @@ public class LoginController { ...@@ -54,6 +60,10 @@ public class LoginController {
@ApiOperation(value = "注销接口", notes = "注销接口") @ApiOperation(value = "注销接口", notes = "注销接口")
@GetMapping("logout") @GetMapping("logout")
@ApiImplicitParams({
@ApiImplicitParam(name = "userName",value = "用户名",required = true),
@ApiImplicitParam(name = "password",value = "密码",required = true)
})
public ResResult logout(@RequestParam("userName") String userName, @RequestParam("password") String password) { public ResResult logout(@RequestParam("userName") String userName, @RequestParam("password") String password) {
// @RequestBody JSONObject jsonObject // @RequestBody JSONObject jsonObject
LoginUser user = new LoginUser(); LoginUser user = new LoginUser();
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.ResResult; import iot.sixiang.license.model.ResResult;
import iot.sixiang.license.model.SamMonitor; import iot.sixiang.license.model.SamMonitor;
...@@ -27,7 +28,6 @@ public class OperateController { ...@@ -27,7 +28,6 @@ public class OperateController {
@ApiOperation(value = "服务接口", notes = "用于获取服务列表") @ApiOperation(value = "服务接口", notes = "用于获取服务列表")
@GetMapping("monitor/server") @GetMapping("monitor/server")
public ResResult getDeviceTypes() { public ResResult getDeviceTypes() {
List<SamMonitor> records = operateManager.getSamMonitorList(); List<SamMonitor> records = operateManager.getSamMonitorList();
return ResResult.success().record(records); return ResResult.success().record(records);
...@@ -41,9 +41,8 @@ public class OperateController { ...@@ -41,9 +41,8 @@ public class OperateController {
@ApiOperation(value = "获取并发量接口", notes = "用于获取并发量") @ApiOperation(value = "获取并发量接口", notes = "用于获取并发量")
@GetMapping("monitor/qps") @GetMapping("monitor/qps")
@ApiImplicitParam(name = "type",value = "类型:0:今天 1:昨天 2:七天前 3:三十天前",required = true, dataType = "int")
public ResResult getQps(@RequestParam("type") int type) { public ResResult getQps(@RequestParam("type") int type) {
HashMap<String, List<Integer>> monitorList = monitorService.getMonitorList(type); HashMap<String, List<Integer>> monitorList = monitorService.getMonitorList(type);
return ResResult.success().record(monitorList); return ResResult.success().record(monitorList);
} }
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.resource.ResourceManager; import iot.sixiang.license.resource.ResourceManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,6 +24,7 @@ public class ResourceContrller { ...@@ -23,6 +24,7 @@ public class ResourceContrller {
@ApiOperation(value = "资源下载接口", notes = "用于下载资源") @ApiOperation(value = "资源下载接口", notes = "用于下载资源")
@GetMapping("/download") @GetMapping("/download")
@ApiImplicitParam(name = "userId",value = "用户Id",required = true, dataType = "int")
public void downloadWorkHourRecordTemplate(HttpServletResponse response, @RequestParam(value = "userId") int userId) { public void downloadWorkHourRecordTemplate(HttpServletResponse response, @RequestParam(value = "userId") int userId) {
try { try {
......
...@@ -2,7 +2,12 @@ package iot.sixiang.license.controller; ...@@ -2,7 +2,12 @@ package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.entity.Server; import iot.sixiang.license.entity.Server;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
...@@ -36,6 +41,10 @@ public class ServerController { ...@@ -36,6 +41,10 @@ public class ServerController {
*/ */
@ApiOperation(value = "添加服务接口", notes = "用于添加服务") @ApiOperation(value = "添加服务接口", notes = "用于添加服务")
@PostMapping("add") @PostMapping("add")
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = {
@DynamicParameter(name = "serverIp",value = "服务Ip",required = true,dataTypeClass = String.class),
@DynamicParameter(name = "port",value = "端口",required = true,dataTypeClass = Integer.class)
}))
public BaseResult addServer(@RequestBody JSONObject jsonObject) { public BaseResult addServer(@RequestBody JSONObject jsonObject) {
String serverIp = jsonObject.getString("serverIp"); String serverIp = jsonObject.getString("serverIp");
int port = jsonObject.getIntValue("port"); int port = jsonObject.getIntValue("port");
...@@ -70,6 +79,10 @@ public class ServerController { ...@@ -70,6 +79,10 @@ public class ServerController {
*/ */
@ApiOperation(value = "修改服务接口", notes = "修改服务") @ApiOperation(value = "修改服务接口", notes = "修改服务")
@PostMapping("update") @PostMapping("update")
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = {
@DynamicParameter(name = "serverIp",value = "服务Ip",required = true,dataTypeClass = String.class),
@DynamicParameter(name = "port",value = "端口",required = true,dataTypeClass = Integer.class)
}))
public BaseResult updateServer(@RequestBody JSONObject jsonObject) { public BaseResult updateServer(@RequestBody JSONObject jsonObject) {
String serverIp = jsonObject.getString("serverIp"); String serverIp = jsonObject.getString("serverIp");
int port = jsonObject.getInteger("port"); int port = jsonObject.getInteger("port");
...@@ -90,7 +103,12 @@ public class ServerController { ...@@ -90,7 +103,12 @@ public class ServerController {
*/ */
@ApiOperation(value = "获取服务列表接口", notes = "用于获取服务列表") @ApiOperation(value = "获取服务列表接口", notes = "用于获取服务列表")
@GetMapping("list") @GetMapping("list")
public ResResult getServerList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) { @ApiImplicitParams({
@ApiImplicitParam(name = "pageNo",value = "当前在第几页", required = true,dataType = "int"),
@ApiImplicitParam(name = "pageSize",value = "每页显示多少页", required = true, dataType = "int")
})
public ResResult getServerList(@RequestParam("pageNo") int pageNo,
@RequestParam("pageSize") int pageSize) {
List<Server> records = serverService.getServerList(pageNo,pageSize); List<Server> records = serverService.getServerList(pageNo,pageSize);
return ResResult.success().record(records); return ResResult.success().record(records);
} }
......
...@@ -6,6 +6,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; ...@@ -6,6 +6,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter; import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters; import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
...@@ -80,6 +82,10 @@ public class UserController { ...@@ -80,6 +82,10 @@ public class UserController {
*/ */
@ApiOperation(value = "用户修改接口", notes = "修改用户") @ApiOperation(value = "用户修改接口", notes = "修改用户")
@PostMapping("update") @PostMapping("update")
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = {
@DynamicParameter(name = "userId",value = "用户Id",required = true,dataTypeClass = Integer.class),
@DynamicParameter(name = "password",value = "密码",required = true,dataTypeClass = String.class)
}))
public BaseResult updateUser(@RequestBody JSONObject jsonObject) { public BaseResult updateUser(@RequestBody JSONObject jsonObject) {
int userId = jsonObject.getInteger("userId"); int userId = jsonObject.getInteger("userId");
String password = jsonObject.getString("password"); String password = jsonObject.getString("password");
...@@ -100,6 +106,12 @@ public class UserController { ...@@ -100,6 +106,12 @@ public class UserController {
*/ */
@ApiOperation(value = "获取用户列表接口", notes = "用于获取用户列表") @ApiOperation(value = "获取用户列表接口", notes = "用于获取用户列表")
@GetMapping("list") @GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo",value = "当前在第几页", required = true,dataType = "int"),
@ApiImplicitParam(name = "pageSize",value = "每页显示多少页", required = true, dataType = "int"),
@ApiImplicitParam(name = "userName",value = "用户名"),
@ApiImplicitParam(name = "company",value = "公司名")
})
public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize",defaultValue = "0") int pageSize, @RequestParam(value = "pageSize",defaultValue = "0") int pageSize,
@RequestParam(value = "userName",required = false) String userName, @RequestParam(value = "userName",required = false) String userName,
......
...@@ -11,4 +11,6 @@ spring: ...@@ -11,4 +11,6 @@ spring:
password: 123456 password: 123456
mybatis-plus: mybatis-plus:
mapper-locations: classpath:/mapper/**.xml mapper-locations: classpath:/mapper/**.xml
type-aliases-package: iot.sixiang.license.entity type-aliases-package: iot.sixiang.license.entity
\ No newline at end of file knife4j:
enable: true
\ No newline at end of file
...@@ -8,4 +8,6 @@ spring: ...@@ -8,4 +8,6 @@ spring:
password: Acc2019123 password: Acc2019123
mybatis-plus: mybatis-plus:
mapper-locations: classpath:/mapper/**.xml mapper-locations: classpath:/mapper/**.xml
type-aliases-package: iot.sixiang.license.entity type-aliases-package: iot.sixiang.license.entity
\ No newline at end of file knife4j:
enable: true
\ No newline at end of file
...@@ -8,4 +8,6 @@ spring: ...@@ -8,4 +8,6 @@ spring:
password: Acc2019123 password: Acc2019123
mybatis-plus: mybatis-plus:
mapper-locations: classpath:/mapper/**.xml mapper-locations: classpath:/mapper/**.xml
type-aliases-package: iot.sixiang.license.entity type-aliases-package: iot.sixiang.license.entity
\ No newline at end of file knife4j:
enable: true
\ 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