Vue + Element UI 實現權限管理系統 前端篇(九):接口格式定義

接口請求格式定義

前臺顯示須要後臺數據,咱們這裏先把先後端交互接口定義好,沒有後臺的時候,也方便用mock模擬。前端

接口定義遵循幾個規範:git

1. 接口按功能模塊劃分。sql

系統登陸:登陸相關接口後端

用戶管理:用戶管理相關接口post

機構管理:機構管理相關接口測試

角色管理 : 角色管理相關接口ui

菜單管理 : 菜單管理相關接口url

字典管理 : 字典管理相關接口spa

日誌管理 : 日誌管理相關接口日誌

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 模擬了。

源碼下載

後端:https://gitee.com/liuge1988/kitty

前端:https://gitee.com/liuge1988/kitty-ui.git


做者:朝雨憶輕塵
出處:https://www.cnblogs.com/xifengxiaoma/ 版權全部,歡迎轉載,轉載請註明原文做者及出處。

相關文章
相關標籤/搜索