当前位置: 首页 > 工具软件 > Swagger > 使用案例 >

swagger的swagger例子

宗安翔
2023-12-01
{
  "swagger": "2.0",
  "info": {
    "description": "这里主要写的是OA4R项目接口的文档",
    "version": "1.0.0",
    "title": "新项目接口",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "email": "xjx@auldey.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "host": "localhost:8091",
  "basePath": "/v2",
  "tags": [
    {
      "name": "OA4R项目",
      "description": "OA4R项目接口"
    }
  ],
  "schemes": [
    "http"
  ],
  "paths": {
    "/weekPlanMain/getBaseInfo": {
      "post": {
        "tags": [
          "OA4R项目"
        ],
        "summary": "通用数据",
        "description": "将基本信息获取出来。包括有现有日期,周一、周日、分部id、分部名称、部门id、部门名称、工号、姓名",
        "parameters": [
          {
            "name": "workcode",
            "in": "body",
            "description": "传输的内容为空号",
            "required": true,
            "schema": {
              "$ref": "#/definitions/getUserBasePar"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/4RUserBase"
            }
          }
        }
      }
    },
    "/weekPlanMain/getUserBase": {
      "post": {
        "tags": [
          "OA4R项目"
        ],
        "summary": "根据工号获取基本用户信息",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "workcode",
            "in": "body",
            "description": "工号",
            "required": true,
            "schema": {
              "$ref": "#/definitions/getUserBasePar"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "操作成功",
            "schema": {
              "$ref": "#/definitions/4RUserBase"
            }
          }
        }
      }
    },
    "/weekPlanMain/addWeekPlan": {
      "post": {
        "tags": [
          "OA4R项目"
        ],
        "summary": "将周计划录入到数据库中",
        "description": "将周计划录入到数据库中",
        "parameters": [
          {
            "name": "mainvo",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/WeekPlanVO"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/weekPlanMain/addWeekComment": {
      "post": {
        "tags": [
          "OA4R项目"
        ],
        "summary": "将周总结点录入",
        "description": "将周总结点录入",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "要传输的json表格",
            "required": true,
            "schema": {
              "$ref": "#/definitions/weeklysummarybody"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "操作记录",
            "schema": {
              "$ref": "#/definitions/normal"
            }
          }
        }
      }
    },
    "/weekPlanMain/addWeekThoughts": {
      "post": {
        "tags": [
          "OA4R项目"
        ],
        "summary": "将周感想保存",
        "description": "将周感想保存",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "要传输的json表格",
            "required": true,
            "schema": {
              "$ref": "#/definitions/weeklythinkbody"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "操作记录",
            "schema": {
              "$ref": "#/definitions/normal"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "WeekPlanVO": {
      "type": "object",
      "description": "添加周计划中--前端进行向后台传输数据接口",
      "properties": {
        "mainvo": {
          "type": "object",
          "format": "object",
          "description": "头部主体",
          "properties": {
            "id": {
              "type": "string",
              "format": "string",
              "description": "id"
            },
            "weekname": {
              "type": "string",
              "format": "string",
              "description": "第几周"
            },
            "workcode": {
              "type": "string",
              "format": "string",
              "description": "工号"
            },
            "lastname": {
              "type": "string",
              "format": "string",
              "description": "姓名"
            },
            "createtime": {
              "type": "string",
              "format": "string",
              "description": "创建时间"
            },
            "subdepartmentid": {
              "type": "string",
              "format": "string",
              "description": "申请分部id"
            },
            "subdepartmentname": {
              "type": "string",
              "format": "string",
              "description": "申请分部名称"
            },
            "departmentid": {
              "type": "string",
              "format": "string",
              "description": "申请部门id"
            },
            "departmentname": {
              "type": "string",
              "format": "string",
              "description": "申请部门名称"
            }
          }
        },
        "indexpro": {
          "type": "array",
          "items": {
            "type": "object",
            "format": "object",
            "description": "指标列表",
            "properties": {
              "planid": {
                "type": "string",
                "format": "string",
                "description": "planid"
              },
              "name": {
                "type": "string",
                "format": "string",
                "description": "指标名称"
              },
              "unit": {
                "type": "string",
                "format": "string",
                "description": "单位"
              },
              "thinresult": {
                "type": "string",
                "format": "string",
                "description": "预期结果"
              },
              "monday": {
                "type": "string",
                "format": "string",
                "description": "周一"
              },
              "tuesday": {
                "type": "string",
                "format": "string",
                "description": "周二"
              },
              "wednesday": {
                "type": "string",
                "format": "string",
                "description": "周三"
              },
              "thursday": {
                "type": "string",
                "format": "string",
                "description": "周四"
              },
              "friday": {
                "type": "string",
                "format": "string",
                "description": "周五"
              },
              "saturday": {
                "type": "string",
                "format": "string",
                "description": "周六"
              },
              "sunday": {
                "type": "string",
                "format": "string",
                "description": "周日"
              },
              "uncompletewillfine": {
                "type": "string",
                "format": "string",
                "description": "未完成承诺自罚"
              }
            }
          }
        },
        "workpro": {
          "type": "array",
          "items": {
            "type": "object",
            "format": "object",
            "description": "数组内对象的内容如下",
            "properties": {
              "planid": {
                "type": "string",
                "format": "string",
                "description": "planid"
              },
              "name": {
                "type": "string",
                "format": "string",
                "description": "工作项目"
              },
              "content": {
                "type": "string",
                "format": "string",
                "description": "工作内容"
              },
              "importance": {
                "type": "string",
                "format": "string",
                "description": "重要度"
              },
              "thinresult": {
                "type": "string",
                "format": "string",
                "description": "周预期结果"
              },
              "agent": {
                "type": "string",
                "format": "string",
                "description": "经办人"
              },
              "cooperator": {
                "type": "string",
                "format": "string",
                "description": "配合人"
              },
              "monday": {
                "type": "string",
                "format": "string",
                "description": "周一"
              },
              "tuesday": {
                "type": "string",
                "format": "string",
                "description": "周二"
              },
              "wednesday": {
                "type": "string",
                "format": "string",
                "description": "周三"
              },
              "thursday": {
                "type": "string",
                "format": "string",
                "description": "周四"
              },
              "friday": {
                "type": "string",
                "format": "string",
                "description": "周五"
              },
              "saturday": {
                "type": "string",
                "format": "string",
                "description": "周六"
              },
              "sunday": {
                "type": "string",
                "format": "string",
                "description": "周日"
              },
              "uncompletewillfine": {
                "type": "string",
                "format": "string",
                "description": "未完成承诺自罚"
              }
            }
          }
        }
      }
    },
    "getUserBasePar": {
      "type": "object",
      "description": "/weekPlanMain/getUserBase前端要传输的参数",
      "properties": {
        "workcode": {
          "type": "string",
          "format": "string",
          "description": "工号"
        }
      }
    },
    "4RUserBase": {
      "type": "object",
      "description": "/weekPlanMain/getUserBase中的传输给前端的数据结构",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int64",
          "description": "操作结果成功失败标识(0:成功,非0:失败)"
        },
        "message": {
          "type": "string",
          "format": "string",
          "description": "操作结果描述"
        },
        "object1": {
          "type": "object",
          "format": "object",
          "properties": {
            "nowDate": {
              "type": "string",
              "format": "string",
              "description": "现在的日期"
            },
            "monday": {
              "type": "string",
              "format": "string",
              "description": "本周周一的日期"
            },
            "sunday": {
              "type": "string",
              "format": "string",
              "description": "本周周日的日期"
            },
            "name": {
              "type": "string",
              "format": "string",
              "description": "姓名"
            },
            "workcode": {
              "type": "string",
              "format": "string",
              "description": "工号"
            },
            "subcompanyid": {
              "type": "string",
              "format": "string",
              "description": "所属公司id"
            },
            "subcompany": {
              "type": "string",
              "format": "string",
              "description": "所属公司名称"
            },
            "departmentid": {
              "type": "string",
              "format": "string",
              "description": "部门id"
            },
            "department": {
              "type": "string",
              "format": "string",
              "description": "部门名称"
            },
            "rank": {
              "type": "string",
              "format": "string",
              "description": "职级"
            },
            "subCompanyInfo": {
              "type": "array",
              "format": "array",
              "description": "所属公司下拉框中的所有内容",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "string",
                    "description": "所属公司id"
                  },
                  "subcompanyname": {
                    "type": "string",
                    "format": "string",
                    "description": ":id所对应的所属公司名称"
                  }
                }
              }
            }
          }
        }
      }
    },
    "weeklysummarybody": {
      "type": "object",
      "description": "将周总结点录入--向后台传输的json格式",
      "properties": {
        "planid": {
          "type": "string",
          "description": "planid 周计划id"
        },
        "workcode": {
          "type": "string",
          "description": "工号"
        },
        "content": {
          "type": "string",
          "description": "总结内容"
        }
      }
    },
    "normal": {
      "type": "object",
      "format": "object",
      "description": "将周总结点录入--返回的结果",
      "properties": {
        "code": {
          "type": "string",
          "description": "code:0,为正常"
        },
        "message": {
          "type": "string",
          "description": "输出的信息"
        },
        "object1": {
          "type": "object",
          "description": "输出的情况,如果正常则为字符串,否则为object类型"
        }
      }
    },
    "weeklythinkbody": {
      "type": "object",
      "format": "object",
      "description": "将周感想保存 -- 前端传输的json格式",
      "properties": {
        "id": {
          "type": "string",
          "description": "周计划id"
        },
        "summary": {
          "type": "string",
          "description": "周感想"
        }
      }
    }
  },
  "externalDocs": {
    "description": "Find out more about Swagger",
    "url": "http://swagger.io"
  }
}

 

转载于:https://my.oschina.net/puguole/blog/2993580

 类似资料: