首先连接Duoceshi_new网络 密码为Duoceshi_new,因为接口项目部署在Duoceshi_new网段中。
测试工具:postman
域名:http://192.168.1.2:8081/ 具体IP根据部署环境修改
注意:所有接口入参出参的数据都是JSON格式,字段含义参考swagger界面。
每个接口Header中必备参数:(登录接口,获取图片验证码接口不需要Authorization)
Key Value
Content-Type application/json
Authorization 登录接口返回的token
用户注册(保存或者更新)
接口名称 用户注册(保存或者更新)
接口地址 http://192.168.1.2:8081/user/save
请求方式 POST
入参 {
"address": "",
"certCode": "",
"certType": "",
"email": "",
"mobile": "13959274195",
"password": "123456",
"realName": "",
"userName": "pero2",
"userType": "",
"systemCode": "SWSW" ,
"userId":""
}
返回数据 {
"code": "200",
"message": "成功"
}
备注 字段含义参考swagger界面
入参:
userId 传值更新,无值新增
用户登录
接口名称 用户登录
接口地址 http://192.168.1.2:8081/user/login
请求方式 POST
入参 {
"captchaCode": "8888",
"captchaKey": "111111",
"password": "123456",
"systemCode": "SWSW",
"userName": "dcs38"
}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"userId": 6,
"userName": "pero.yan",
"userType": "",
"systemCode": "SWSW",
"token": "OWNmYzk5YjctYmMwZi00NzM5LWIw
ZTEtZDJjZTZlZmQzMmVkMTU2MDM4OTQ4NzI4Mw=="
}
}
备注 "captchaCode": "8081", //8081万能校验码
用户分页查询
接口名称 用户分页查询
接口地址 http://192.168.1.2:8081/user/pages
请求方式 POST
入参 {
"userName": "",
"page":1,
"sizee":10
}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"sizeCount": 2,
"pageCount": 1,
"list": [
{
"userId": 6,
"userName": "pero.yan",
"password": "$2a$10$u12wnlqw2vwGBf1KcTap2Opona59rZEavotlGNJzvOn2CHyXnFUl.",
"realName": "",
"userType": "",
"certType": "",
"certCode": "",
"mobile": "13959274195",
"address": "",
"email": "",
"isDeleted": "0",
"createBy": null,
"createTime": "2019-06-12 04:10:46",
"updateBy": null,
"updateTime": "2019-06-12 04:10:46",
"systemCode": "SWSW"
}
]
}
}
备注 入参:
"userName": "", //查询条件
"page":1, //当前页
"sizee":10 //每页多少条
用户详情
接口名称 用户详情
接口地址 http://192.168.1.2:8081/user/getUser/{userId}
请求方式 GET
入参 {userId} //用户ID 比如 /user/getUser/666
返回数据 {
"code": "200",
"message": "成功",
"data": {
"userId": 6,
"userName": "pero.yan",
"password": "$2a$10$u12wnlqw2vwGBf1KcTap2Opona59rZEavotlGNJzvOn2CHyXnFUl.",
"realName": "",
"userType": "",
"certType": "",
"certCode": "",
"mobile": "13959274195",
"address": "",
"email": "",
"isDeleted": "0",
"createBy": null,
"createTime": "2019-06-12 04:10:46",
"updateBy": null,
"updateTime": "2019-06-12 04:10:46",
"systemCode": "SWSW"
}
}
}
备注
获取图片验证码
接口名称 获取图片验证码
接口地址 http://192.168.1.2:8081/user/imgCode
请求方式 POST
入参 {}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"captchaKey": "2ede69f5930a4dce9e48710234b824f4",
"img": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAgA...
}
}
备注 出参:
Img: base64编码的字节数组,前端src 属性可以直接读取显示图片
添加角色 (保存或更新)
接口名称 添加角色
接口地址 http://192.168.1.2:8081/khcs/role/saveRole
请求方式 POST
入参 {
"description": "学生1",
"roleId": "",
"roleName": "学生",
"systemCode": "SWSW"
}
返回数据 {
"code": "200",
"message": "成功"
}
备注 入参:
roleId传值更新,无值新增
角色分页列表
接口名称 角色分页列表
接口地址 http://192.168.1.2:8081/khcs/role/rolePages
请求方式 POST
入参 {
"systemCode":"SWSW"
}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"sizeCount": 4,
"pageCount": 1,
"list": [
{
"roleId": 19,
"roleName": "学生",
"systemCode": "SWSW",
"description": "学生1",
"orders": 1,
"createTime": "2019-06-12 22:40:32",
"updateTime": "2019-06-12 22:48:18"
},
{
"roleId": 18,
"roleName": "老师",
"systemCode": "SWSW",
"description": "老师",
"orders": 1,
"createTime": "2019-06-12 22:40:16",
"updateTime": "2019-06-12 22:40:16"
},
{
"roleId": 17,
"roleName": "普通管理员",
"systemCode": "SWSW",
"description": "普通管理员",
"orders": 1,
"createTime": "2019-06-12 22:40:13",
"updateTime": "2019-06-12 22:40:13"
},
{
"roleId": 16,
"roleName": "超级管理员",
"systemCode": "SWSW",
"description": "超级管理员",
"orders": 1,
"createTime":"2019-06-12 22:37:47",
"updateTime":"2019-06-12 22:37:47"
}
]
}
}
备注
删除角色
接口名称 删除角色
接口地址 http://192.168.1.2:8081/khcs/role/delRole
请求方式 POST
入参 {
"roleId": ""
}
返回数据 {
"code": "200",
"message": "成功"
}
备注 删除为软删除:表字段 is_deleted = 1
roleId : 角色ID
用户角色分配
接口名称 用户角色分配
接口地址 http://192.168.1.2:8081/khcs/role/saveUserRole
请求方式 POST
入参 {
"addRoles": [1,2],
"userId": "6"
}
返回数据 {
"code": "200",
"message": "成功"
}
备注 入参:
"addRoles": [1,2] //角色ID数组
添加权限(保存或更新)
接口名称 添加权限
接口地址 http://192.168.1.2:8081/khcs/role/savePermission
请求方式 POST
入参 {
"accessUri": "/permissions",
"orders": 97,
"parentPermissionId": 1,
"permissionId": "",
"permissionName": "资源管理",
"permissionType": "1",
"systemCode": "SWSW"
}
返回数据 {
"code": "200",
"message": "成功"
}
备注 入参:
permissionId 传值更新,无值新增
parentPermissionId 父权限ID
权限分页列表
接口名称 权限分页列表
接口地址 http://192.168.1.2:8081/khcs/role/permissionPages
请求方式 POST
入参 {
"permissionName": "",
"systemCode": "SWSW",
"page":1,
"sizee":10
}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"sizeCount": 4,
"pageCount": 1,
"list": [
{
"permissionId": 4,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "资源管理",
"accessUri": "/permissions",
"subPermissions": null
},
{
"permissionId": 3,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "角色资源管理",
"accessUri": "/role-permissions",
"subPermissions": null
},
{
"permissionId": 2,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "用户角色管理",
"accessUri": "/user-roles",
"subPermissions": null
},
{
"permissionId": 1,
"systemCode": "SWSW",
"parentPermissionId": 0,
"permissionType": "1",
"permissionName": "权限管理",
"accessUri": "",
"subPermissions": null
}
]
}
}
备注
删除权限
接口名称 删除权限
接口地址 http://192.168.1.2:8081/khcs/role/delPermission
请求方式 POST
入参 {
"permissionId": "999"
}
返回数据 {
"code": "200",
"message": "成功"
}
备注 permissionId 权限ID
权限列表
接口名称 权限列表
接口地址 http://192.168.1.2:8081/khcs/role/permissionList
请求方式 POST
入参 {
"systemCode": "SWSW"
}
返回数据 {
"code": "200",
"message": "成功",
"data": [
{
"permissionId": 1,
"systemCode": "SWSW",
"parentPermissionId": 0,
"permissionType": "1",
"permissionName": "权限管理",
"accessUri": "",
"subPermissions": [
{
"permissionId": 2,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "用户角色管理",
"accessUri": "/user-roles",
"subPermissions": null
},
{
"permissionId": 3,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "角色资源管理",
"accessUri": "/role-permissions",
"subPermissions": null
},
{
"permissionId": 4,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "资源管理",
"accessUri": "/permissions",
"subPermissions": null
}
]
}
]
}
备注 入参:
systemCode 系统编码
用户的权限
接口名称 用户的权限
接口地址 http://192.168.1.2:8081/khcs/role/userPermissions
请求方式 POST
入参 {} // 这里传空值,后台用token获取用户信息
返回数据 {
"code": "200",
"message": "成功",
"data": {
"userId": 6,
"systemCode": "SWSW",
"userName": "pero.yan",
"roles": [
{
"roleId": 16,
"roleName": "超级管理员",
"systemCode": "SWSW",
"description": "超级管理员",
"orders": null,
"createTime": null,
"updateTime": null
},
{
"roleId": 17,
"roleName": "普通管理员",
"systemCode": "SWSW",
"description": "普通管理员",
"orders": null,
"createTime": null,
"updateTime": null
}
],
"permissions": [
{
"permissionId": 1,
"systemCode": "SWSW",
"parentPermissionId": 0,
"permissionType": "1",
"permissionName": "权限管理",
"accessUri": "",
"subPermissions": [
{
"permissionId": 2,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "用户角色管理",
"accessUri": "/user-roles",
"subPermissions": null
},
{
"permissionId": 3,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "角色资源管理",
"accessUri": "/role-permissions",
"subPermissions": null
},
{
"permissionId": 4,
"systemCode": "SWSW",
"parentPermissionId": 1,
"permissionType": "1",
"permissionName": "资源管理",
"accessUri": "/permissions",
"subPermissions": null
}
]
}
]
}
}
备注
角色详情
接口名称 角色详情
接口地址 http://192.168.1.2:8081/khcs/role/getRole
请求方式 POST
入参 {
"roleId": "16"
}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"roleId": 16,
"roleName": "超级管理员",
"systemCode": "SWSW",
"description": "超级管理员",
"orders": 1,
"createTime": "2019-06-12 22:37:47",
"updateTime": "2019-06-12 22:37:47"
}
}
备注
权限详情
接口名称 权限详情
接口地址 http://192.168.1.2:8081/khcs/role/getPermission
请求方式 POST
入参 {
"permissionId": "1"
}
返回数据 {
"code": "200",
"message": "成功",
"data": {
"permissionId": 1,
"systemCode": "SWSW",
"parentPermissionId": 0,
"permissionType": "1",
"permissionName": "权限管理",
"accessUri": "",
"subPermissions": null
}
}
备注
xxx
接口名称
接口地址 http://192.168.1.2:8081/
请求方式
入参
返回数据
备注
备注