Vue + Element UI 前端篇(九):接口格式定义

news2024/11/26 16:37:13

接口请求格式定义

前台显示需要后台数据,我们这里先把前后端交互接口定义好,没有后台的时候,也方便用mock模拟。

接口定义遵循几个规范:

1. 接口按功能模块划分。

系统登录:登录相关接口

用户管理:用户管理相关接口

机构管理:机构管理相关接口

角色管理 : 角色管理相关接口

菜单管理 : 菜单管理相关接口

字典管理 : 字典管理相关接口

日志管理 : 日志管理相关接口

2. 通用增删改查接口采用统一命名规范。

save : 保存操作

update: 更新操作

delete: 删除操作

findAll: 查询全部

findPage : 分页查询

findTree : 返回对象树

findByXX:根据XX查询

2. 统一请求响应结果。

格式如下:

复制代码

{
  "code": 200, // 状态吗,200:请求成功,其他:请求出错
  "msg": null, // 错误消息,成功返回 null, 否则返回出错信息
  "data": {   // 返回请求数据,JSON 数据格式
    ...
  }
}

复制代码

系统登录

登录接口

请求URL: /sys/login

请求类型: post

请求参数:

{
  "captcha": "3323",
  "password": "admin",
  "username": "admin"
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": {
    "id": null,
    "userId": 1,
    "token": "77ae89be36504adfb5c09ef71409ea0e",
    "expireTime": "2018-09-01T16:24:50.473+0000",
    "createBy": null,
    "createTime": null,
    "lastUpdateBy": null,
    "lastUpdateTime": "2018-09-01T04:24:50.473+0000"
  }
}

复制代码

用户管理

保存

请求URL: /user/save

请求类型: post

请求参数:

复制代码

{
  "createBy": 0,
  "createTime": "2018-09-01T05:40:23.342Z",
  "delFlag": 0,
  "deptId": 110,
  "deptName": "",
  "email": "test@qq.com",
  "lastUpdateBy": 0,
  "lastUpdateTime": "2018-09-01T05:40:23.342Z",
  "mobile": "18999878998",
  "password": "123456",
  "salt": "1312321321",
  "status": 0,
  "userId": 110,
  "username": "test"
}

复制代码

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

修改

请求URL: /user/update

请求类型: post

请求参数:

{
  "mobile": "test2@qq.com",
  "userId": 110,
  "username": "test"
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

删除

请求URL: /user/delete

请求类型: post

请求参数:

{
  "userId": 110
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

分页查询

请求URL: /user/findPage

请求类型: post

请求参数:

{
  "pageNum": 1,
  "pageSize": 5
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": {
    "pageNum": 1,
    "pageSize": 5,
    "totalSize": 5,
    "totalPages": 1,
    "content": [
      {
        "userId": 1,
        "username": "admin",
        "password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
        "salt": "YzcmCZNvbXocrsz9dm8e",
        "email": "admin@qq.com",
        "mobile": "13612345678",
        "status": 1,
        "deptId": null,
        "deptName": null,
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "userId": 2,
        "username": "Louis",
        "password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
        "salt": "YzcmCZNvbXocrsz9dm8e",
        "email": "louis@qq.com",
        "mobile": "18200932238",
        "status": 1,
        "deptId": null,
        "deptName": null,
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "userId": 3,
        "username": "Kobe",
        "password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
        "salt": "YzcmCZNvbXocrsz9dm8e",
        "email": "kobe@qq.com",
        "mobile": "18200932238",
        "status": 1,
        "deptId": null,
        "deptName": null,
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "userId": 4,
        "username": "Iverson",
        "password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
        "salt": "YzcmCZNvbXocrsz9dm8e",
        "email": "iverson@qq.com",
        "mobile": "18200932238",
        "status": 1,
        "deptId": null,
        "deptName": null,
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "userId": 110,
        "username": "test",
        "password": "123456",
        "salt": "1312321321",
        "email": "test@qq.com",
        "mobile": "test2@qq.com",
        "status": 0,
        "deptId": 110,
        "deptName": null,
        "createBy": 0,
        "createTime": "2018-09-01T05:40:23.000+0000",
        "lastUpdateBy": 0,
        "lastUpdateTime": "2018-09-01T05:40:23.000+0000",
        "delFlag": 0
      }
    ]
  }
}

复制代码

根据用户查询

请求URL: /user/findByUserName

请求类型: get

请求参数:

{
  "userName": "admin"
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": {
    "userId": 1,
    "username": "admin",
    "password": "9ec9750e709431dad22365cabc5c625482e574c74adaebba7dd02f1129e4ce1d",
    "salt": "YzcmCZNvbXocrsz9dm8e",
    "email": "admin@qq.com",
    "mobile": "13612345678",
    "status": 1,
    "deptId": null,
    "deptName": null,
    "createBy": null,
    "createTime": "2018-08-14T03:11:11.000+0000",
    "lastUpdateBy": null,
    "lastUpdateTime": null,
    "delFlag": 0
  }
}

复制代码

更新密码

请求URL: /user/updatePassword

请求类型: get

请求参数:

{
  "password ": "password ",
  "newPassword ": "newPassword "
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

机构管理

保存

请求URL: /dept/save

请求类型: post

请求参数:

复制代码

{
  "children": [
    null
  ],
  "createBy": 0,
  "createTime": "2018-09-01T05:34:44.618Z",
  "delFlag": 0,
  "deptId": 110,
  "lastUpdateBy": 0,
  "lastUpdateTime": "2018-09-01T05:34:44.618Z",
  "name": "110",
  "orderNum": 0,
  "parentId": 0
}

复制代码

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

修改

请求URL: /dept/update

请求类型: post

请求参数:

{
  "deptId": 110,
  "name": "upate"
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

删除

请求URL: /dept/delete

请求类型: post

请求参数:

{
  "deptId": 110
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

查询机构树

请求URL: /dept/findTree

请求类型: get

请求参数:

{
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": [
    {
      "deptId": 1,
      "parentId": 0,
      "name": "轻尘集团",
      "orderNum": 0,
      "createBy": null,
      "createTime": null,
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0,
      "children": [
        {
          "deptId": 2,
          "parentId": 1,
          "name": "北京分公司",
          "orderNum": 1,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        },
        {
          "deptId": 3,
          "parentId": 1,
          "name": "上海分公司",
          "orderNum": 2,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "deptId": 4,
              "parentId": 3,
              "name": "技术部",
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "deptId": 6,
              "parentId": 3,
              "name": "宣传部",
              "orderNum": 1,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "deptId": 7,
              "parentId": 3,
              "name": "销售部",
              "orderNum": 2,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "deptId": 8,
              "parentId": 3,
              "name": "市场部",
              "orderNum": 3,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        }
      ]
    },
    {
      "deptId": 9,
      "parentId": 0,
      "name": "牧尘集团",
      "orderNum": 1,
      "createBy": null,
      "createTime": null,
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0,
      "children": [
        {
          "deptId": 10,
          "parentId": 9,
          "name": "北京分公司",
          "orderNum": 1,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "deptId": 12,
              "parentId": 10,
              "name": "技术部",
              "orderNum": 1,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "deptId": 13,
              "parentId": 10,
              "name": "宣传部",
              "orderNum": 2,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        },
        {
          "deptId": 11,
          "parentId": 9,
          "name": "上海分公司",
          "orderNum": 2,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "deptId": 14,
              "parentId": 11,
              "name": "销售部",
              "orderNum": 1,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "deptId": 15,
              "parentId": 11,
              "name": "市场部",
              "orderNum": 2,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        }
      ]
    }
  ]
}

复制代码

角色管理

保存

请求URL: /role/save

请求类型: post

请求参数:

复制代码

{
  "createBy": 0,
  "createTime": "2018-09-01T05:54:31.748Z",
  "delFlag": 0,
  "lastUpdateBy": 0,
  "lastUpdateTime": "2018-09-01T05:54:31.748Z",
  "remark": "string",
  "roleId": 110,
  "roleName": "110"
}

复制代码

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

修改

请求URL: /role/update

请求类型: post

请求参数:

{
  "remark": "1101111",
  "roleId": 110,
  "roleName": "1101"
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

删除

请求URL: /role/delete

请求类型: post

请求参数:

{
  "roleId": 110
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

分页查询

请求URL: /role/findPage

请求类型: post

请求参数:

{
  "pageNum": 1,
  "pageSize": 5
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": {
    "pageNum": 1,
    "pageSize": 5,
    "totalSize": 4,
    "totalPages": 1,
    "content": [
      {
        "roleId": 1,
        "roleName": "admin",
        "remark": "超级管理员",
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "roleId": 2,
        "roleName": "dev",
        "remark": "开发人员",
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "roleId": 3,
        "roleName": "test",
        "remark": "测试人员",
        "createBy": null,
        "createTime": "2018-08-14T03:11:11.000+0000",
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "delFlag": 0
      },
      {
        "roleId": 110,
        "roleName": "1101",
        "remark": "1101111",
        "createBy": 0,
        "createTime": "2018-09-01T05:54:32.000+0000",
        "lastUpdateBy": 0,
        "lastUpdateTime": "2018-09-01T05:54:32.000+0000",
        "delFlag": 0
      }
    ]
  }
}

复制代码

查询全部

请求URL: /role/findAll

请求类型: get

请求参数:

{
 
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": [
    {
      "roleId": 1,
      "roleName": "admin",
      "remark": "超级管理员",
      "createBy": null,
      "createTime": "2018-08-14T03:11:11.000+0000",
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0
    },
    {
      "roleId": 2,
      "roleName": "dev",
      "remark": "开发人员",
      "createBy": null,
      "createTime": "2018-08-14T03:11:11.000+0000",
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0
    },
    {
      "roleId": 3,
      "roleName": "test",
      "remark": "测试人员",
      "createBy": null,
      "createTime": "2018-08-14T03:11:11.000+0000",
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0
    },
    {
      "roleId": 110,
      "roleName": "1101",
      "remark": "1101111",
      "createBy": 0,
      "createTime": "2018-09-01T05:54:32.000+0000",
      "lastUpdateBy": 0,
      "lastUpdateTime": "2018-09-01T05:54:32.000+0000",
      "delFlag": 0
    }
  ]
}

复制代码

菜单管理

保存

请求URL: /menu/save

请求类型: post

请求参数:

复制代码

{
  "createBy": 0,
  "createTime": "2018-09-01T06:01:47.825Z",
  "delFlag": 0,
  "icon": "string",
  "lastUpdateBy": 0,
  "lastUpdateTime": "2018-09-01T06:01:47.825Z",
  "menuId": 110,
  "name": "110",
  "orderNum": 0,
  "parentId": 0,
  "perms": "sys:menu:list",
  "type": 0,
  "url": "/sys/menu"
}

复制代码

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

修改

请求URL: /menu/update

请求类型: post

请求参数:

{
  "menuId": 110,
  "name": "1101"
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

删除

请求URL: /menu/delete

请求类型: post

请求参数:

{
  "menuId": 110
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

查询菜单树

请求URL: /menu/findTree

请求类型: get

请求参数:

{
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": [
    {
      "menuId": 1,
      "parentId": 0,
      "name": "系统管理",
      "url": null,
      "perms": null,
      "type": 0,
      "icon": "fa el-icon-setting",
      "orderNum": 0,
      "createBy": null,
      "createTime": null,
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0,
      "children": [
        {
          "menuId": 2,
          "parentId": 1,
          "name": "用户管理",
          "url": "/sys/user",
          "perms": null,
          "type": 1,
          "icon": "el-icon-service",
          "orderNum": 1,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "menuId": 9,
              "parentId": 2,
              "name": "查看",
              "url": null,
              "perms": "sys:user:view",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 10,
              "parentId": 2,
              "name": "新增",
              "url": null,
              "perms": "sys:user:save",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 11,
              "parentId": 2,
              "name": "修改",
              "url": null,
              "perms": "sys:user:update",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 12,
              "parentId": 2,
              "name": "删除",
              "url": null,
              "perms": "sys:user:delete",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        },
        {
          "menuId": 3,
          "parentId": 1,
          "name": "机构管理",
          "url": "/sys/dept",
          "perms": null,
          "type": 1,
          "icon": "el-icon-news",
          "orderNum": 2,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "menuId": 13,
              "parentId": 3,
              "name": "查看",
              "url": null,
              "perms": "sys:dept:view",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 14,
              "parentId": 3,
              "name": "新增",
              "url": null,
              "perms": "sys:dept:save",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 15,
              "parentId": 3,
              "name": "修改",
              "url": null,
              "perms": "sys:dept:update",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 16,
              "parentId": 3,
              "name": "删除",
              "url": null,
              "perms": "sys:dept:delete",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        },
        {
          "menuId": 4,
          "parentId": 1,
          "name": "角色管理",
          "url": "/sys/role",
          "perms": null,
          "type": 1,
          "icon": "el-icon-view",
          "orderNum": 4,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "menuId": 17,
              "parentId": 4,
              "name": "查看",
              "url": null,
              "perms": "sys:role:view",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 18,
              "parentId": 4,
              "name": "新增",
              "url": null,
              "perms": "sys:role:save",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 19,
              "parentId": 4,
              "name": "修改",
              "url": null,
              "perms": "sys:role:update",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 20,
              "parentId": 4,
              "name": "删除",
              "url": null,
              "perms": "sys:role:delete",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        },
        {
          "menuId": 5,
          "parentId": 1,
          "name": "菜单管理",
          "url": "/sys/menu",
          "perms": null,
          "type": 1,
          "icon": "el-icon-menu",
          "orderNum": 5,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": [
            {
              "menuId": 21,
              "parentId": 5,
              "name": "查看",
              "url": null,
              "perms": "sys:menu:view",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 22,
              "parentId": 5,
              "name": "新增",
              "url": null,
              "perms": "sys:menu:save",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 23,
              "parentId": 5,
              "name": "修改",
              "url": null,
              "perms": "sys:menu:update",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            },
            {
              "menuId": 24,
              "parentId": 5,
              "name": "删除",
              "url": null,
              "perms": "sys:menu:delete",
              "type": 2,
              "icon": null,
              "orderNum": 0,
              "createBy": null,
              "createTime": null,
              "lastUpdateBy": null,
              "lastUpdateTime": null,
              "delFlag": 0,
              "children": []
            }
          ]
        },
        {
          "menuId": 6,
          "parentId": 1,
          "name": "SQL监控",
          "url": "/druid/sql",
          "perms": null,
          "type": 1,
          "icon": "el-icon-info",
          "orderNum": 6,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        },
        {
          "menuId": 8,
          "parentId": 1,
          "name": "系统日志",
          "url": "/sys/log",
          "perms": "sys:log:list",
          "type": 1,
          "icon": "el-icon-info",
          "orderNum": 7,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        }
      ]
    },
    {
      "menuId": 25,
      "parentId": 0,
      "name": "内容管理",
      "url": null,
      "perms": null,
      "type": 0,
      "icon": "el-icon-document",
      "orderNum": 0,
      "createBy": null,
      "createTime": null,
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0,
      "children": [
        {
          "menuId": 26,
          "parentId": 25,
          "name": "栏目管理",
          "url": "/content/category",
          "perms": null,
          "type": 1,
          "icon": "el-icon-tickets",
          "orderNum": 1,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        },
        {
          "menuId": 27,
          "parentId": 25,
          "name": "文章管理",
          "url": "/content/artical",
          "perms": null,
          "type": 1,
          "icon": "el-icon-tickets",
          "orderNum": 2,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        }
      ]
    },
    {
      "menuId": 28,
      "parentId": 0,
      "name": "使用案例",
      "url": null,
      "perms": null,
      "type": 0,
      "icon": "el-icon-picture-outline",
      "orderNum": 0,
      "createBy": null,
      "createTime": null,
      "lastUpdateBy": null,
      "lastUpdateTime": null,
      "delFlag": 0,
      "children": [
        {
          "menuId": 29,
          "parentId": 28,
          "name": "国际化",
          "url": "/demo/i18n",
          "perms": null,
          "type": 1,
          "icon": "el-icon-edit",
          "orderNum": 1,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        },
        {
          "menuId": 30,
          "parentId": 28,
          "name": "换皮肤",
          "url": "/demo/theme",
          "perms": null,
          "type": 1,
          "icon": "el-icon-picture",
          "orderNum": 2,
          "createBy": null,
          "createTime": null,
          "lastUpdateBy": null,
          "lastUpdateTime": null,
          "delFlag": 0,
          "children": []
        }
      ]
    }
  ]
}

复制代码

字典管理

保存

请求URL: /dict/save

请求类型: post

请求参数:

复制代码

{
  "createBy": 0,
  "createTime": "2018-09-01T06:05:44.794Z",
  "delFlag": 0,
  "description": "aaaa",
  "id": 110,
  "label": "aa",
  "lastUpdateBy": 0,
  "lastUpdateTime": "2018-09-01T06:05:44.794Z",
  "remarks": "aaaaaa",
  "sort": 0,
  "type": "a",
  "value": "aaaaa"
}

复制代码

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

修改

请求URL: /dict/update

请求类型: post

请求参数:

{
  "description": "bbbb",
  "id": 110,
  "label": "bbbb"
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

删除

请求URL: /dict/delete

请求类型: post

请求参数:

{
  "id": 110
}

请求结果:

{
  "code": 200,
  "msg": null,
  "data": 1
}

分页查询

请求URL: /dict/findPage

请求类型: get

请求参数:

{
  "pageNum": 1,
  "pageSize": 5
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": {
    "pageNum": 1,
    "pageSize": 5,
    "totalSize": 2,
    "totalPages": 1,
    "content": [
      {
        "id": 1,
        "value": "male",
        "label": "男",
        "type": "sex",
        "description": "男性",
        "sort": 0,
        "createBy": null,
        "createTime": null,
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "remarks": null,
        "delFlag": 0
      },
      {
        "id": 2,
        "value": "female",
        "label": "女",
        "type": "sex",
        "description": "女性",
        "sort": 1,
        "createBy": null,
        "createTime": null,
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "remarks": null,
        "delFlag": 0
      }
    ]
  }
}

复制代码

日志管理

分页查询

请求URL: /log/findPage

请求类型: get

请求参数:

{
  "pageNum": 1,
  "pageSize": 5
}

请求结果:

复制代码

{
  "code": 200,
  "msg": null,
  "data": {
    "pageNum": 1,
    "pageSize": 5,
    "totalSize": 2,
    "totalPages": 1,
    "content": [
      {
        "id": 1,
        "value": "male",
        "label": "男",
        "type": "sex",
        "description": "男性",
        "sort": 0,
        "createBy": null,
        "createTime": null,
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "remarks": null,
        "delFlag": 0
      },
      {
        "id": 2,
        "value": "female",
        "label": "女",
        "type": "sex",
        "description": "女性",
        "sort": 1,
        "createBy": null,
        "createTime": null,
        "lastUpdateBy": null,
        "lastUpdateTime": null,
        "remarks": null,
        "delFlag": 0
      }
    ]
  }
}

复制代码

好了,后续前台页面需要调用相关接口的时候,就可以用上面的格式进行 mock 模拟了。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/978540.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Redis-1.4-过期策略

1 设置带过期时间的 key # 时间复杂度:O(1),最常用方式 expire key seconds# 字符串独有方式 setex(String key, int seconds, String value)除了string独有设置过期时间的方法,其他类型都需依靠expire方法设置时间&a…

说说MySQL回表查询与覆盖索引

分析&回答 什么是回表查询? 通俗的讲就是,如果索引的列在 select 所需获得的列中(因为在 mysql 中索引是根据索引列的值进行排序的,所以索引节点中存在该列中的部分值)或者根据一次索引查询就能获得记录就不需要…

【Linux】Qt Remote之Remote开发环境搭建填坑小记

总体思路 基于WSL2(Ubuntu 22.04 LTS)原子Alpha开发板进行Qt开发实验,基于Win11通过vscode remote到WSL2,再基于WSL2通过Qt 交叉编译,并通过sshrsync远程到开发板,构建起开发工具链。 Step1 基于Win11通过…

Mock接口测试

什么是mock? 测试桩,模拟被测对象的返回,用于测试 通常意义的mock指的就是mock server, 模拟服务端返回的接口数据,用于前端开发,第三方接口联调 为什么要mock? 1. 解决依赖问题:当我们测试一个接口或者功能模块…

Python Opencv实践 - 轮廓特征(最小外接圆,椭圆拟合)

import cv2 as cv import numpy as np import matplotlib.pyplot as pltimg cv.imread("../SampleImages/stars.PNG") plt.imshow(img[:,:,::-1])#轮廓检测 img_gray cv.cvtColor(img, cv.COLOR_BGR2GRAY) ret,thresh cv.threshold(img_gray, 127, 255, 0) contou…

Unity汉化一个插件 制作插件汉化工具

我是编程一个菜鸟,英语又不好,有的插件非常牛!我想学一学,页面全是英文,完全不知所措,我该怎么办啊...尝试在Unity中汉化一个插件 效果: 思路: 如何在Unity中把一个自己喜欢的插件…

Flutter 最优秀动画库「完全商业化」,Rive 2 你全面了解过吗?

说到 rive ,非 Flutter 开发者可能会感觉比较陌生,而做过 Flutter 开发的可能对 rive 会有所耳闻,因为 rive 在一开始叫 flare ,是 2dimensions 公司的开源动画产品,在发布之初由于和 Flutter 团队有深入合作&#xff…

golang获取prometheus数据(prometheus/client_golang包)

文章目录 1. 创建链接1.1 语法1.2 完整示例 2. 简单查询2.1 语法2.2 完整示例 3. 范围值查询3.1 语法3.2 完整示例 【附官方示例】 1. 创建链接 1.1 语法 语法 func NewClient(cfg Config) (Client, error)结构体 type Config struct {Address stringClient *ht…

16-数据结构-图的存储结构

简介:主要为图的顺序存储和链式存储。其中顺序存储即邻接矩阵的画法以及代码,邻接矩阵又分为有权图和无权图,区别就是有数据的地方填权值,无数据的地方可以填0或者∞,而有权图和无权图,又细分为有向图和无向…

阿里云服务器退款政策及退款流程解析

阿里云服务器如何退款?云服务器在哪申请退款?在用户中心订单管理中的退订管理中退款,阿里云百科分享阿里云服务器退款流程,包括申请退款入口、云服务器退款限制条件、退款多久到账等详细说明: 目录 阿里云服务器退款…

FPGA GTH 全网最细讲解,aurora 8b/10b协议,HDMI板对板视频传输,提供2套工程源码和技术支持

目录 1、前言免责声明 2、我这里已有的 GT 高速接口解决方案3、GTH 全网最细解读GTH 基本结构GTH 发送和接收处理流程GTH 的参考时钟GTH 发送接口GTH 接收接口GTH IP核调用和使用 4、设计思路框架视频源选择silicon9011解码芯片配置及采集动态彩条视频数据组包GTH aurora 8b/10…

【Java 基础篇】深入理解 Java 内部类:嵌套在嵌套中的编程奇妙世界

在 Java 编程中,内部类(Inner Class)是一个非常强大且灵活的概念,它允许在一个类的内部定义另一个类。内部类可以访问外部类的成员,包括私有成员,这使得内部类在许多编程场景中都非常有用。本篇博客将详细介…

js如何实现数组去重的常用方法

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ 使用 Set(ES6)⭐ 使用 filter 和 indexOf⭐ 使用 reduce⭐ 使用对象属性⭐ 使用 includes 方法(ES6)⭐ 写在最后 ⭐ 专栏简介 前端入门之旅:探索Web开发的奇妙世界 记得点击上方…

$ref属性的介绍与使用

在Vue.js中,$ref是一个特殊的属性,用于访问Vue组件中的DOM元素或子组件实例。它允许你直接访问组件内部的DOM元素或子组件,并且可以在需要时进行操作或修改。以下是有关$ref的详细介绍和示例演示,给大家做一个简单的介绍和概念区分…

库中是如何实现string类的?

🎈个人主页:🎈 :✨✨✨初阶牛✨✨✨ 🐻推荐专栏1: 🍔🍟🌯C语言初阶 🐻推荐专栏2: 🍔🍟🌯C语言进阶 🔑个人信条: 🌵知行合一 &#x1f…

如何查看B站UP主数据?如何看懂B站数据?

bilibili是独特且稀缺的PUGC视频社区,拥有浓厚社区氛围的视频社区。有别于短视频,PUGC视频创作门槛高,视频内容更充实,bilibili是PUGC视频行业的领跑者,同时,bilibili拥有社区产品特有的高创作渗透率和高互…

SQL SERVER 如何实现UNDO REDO 和PostgreSQL 有近亲关系吗

开头还是介绍一下群,如果感兴趣PolarDB ,MongoDB ,MySQL ,PostgreSQL ,SQL Server,Redis ,Oracle ,Oceanbase 等有问题,有需求都可以加群群内有各大数据库行业大咖,CTO,可以解决你的问题。加群请加微信号 l…

分类任务评价指标

分类任务评价指标 分类任务中,有以下几个常用指标: 混淆矩阵准确率(Accuracy)精确率(查准率,Precision)召回率(查全率,Recall)F-scorePR曲线ROC曲线 1. 混…

配置Jenkins

主要是配置Jenkins和jdk,maven的插件

Spring Cloud Alibaba Nacos配置导入问题解决方案

🌷🍁 博主猫头虎(🐅🐾)带您 Go to New World✨🍁 🦄 博客首页——🐅🐾猫头虎的博客🎐 🐳 《面试题大全专栏》 🦕 文章图文…