发表于: 2019-10-20 00:51:42

1 1009


今天完成的事情:(一定要写非常细致的内容,比如说学会了盒子模型,了解了Margin)

终于解决分页插件不生效的问题了。

参考https://blog.csdn.net/double7z/article/details/80339925

一:引用依赖

二:将分页功能放在service

解决分页问题。


又是一群问题:前端要我返回一个对象把所有的数据返回,还要求我给他们返回连表查询的对象,把所有的东西全在一个对象中返回。

无法完成的需求。

继续测试接口:

增加管理员接口失败:

2019-10-20 17:57:29.291 ERROR 31349 --- [o-20854-exec-10] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0] with root cause

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0


 在往数据库添加数据需要判断数据库中是否已有记录,判断的返回结果通常是List。在List为空的情况下,调用其方法需要格外注意,例如:调用get()则会报下标越界的异常。

    当然还可以联想到其他情况,当判断数组、集合为空后,注意不要取其中内容,不然就会报上述错误。


我的原因是:我的角色不存在角色列表中。新增在角色列表中的角色即可。


编辑管理员页面接口:调试成功;

查找管理员接口:调试成功。

删除管理员接口:因为没有开启权限url,所以不能调试。


调试角色接口:

前端给我说,他不能处理

"code": "10200",
"msg": "success",
"data": {
"manager_roles": {
"Manager{id=1, name='admin', password='0078be3e89625bc3684af8faeb317ca1', salt='yrt1PH2i9xYJa3Rn61OjRg==', createAt=1571288165, updateAt=1571569499, createBy=1, updateBy=1}": [
null
],
"Manager{id=10, name='我是坏学生', password='3f2754b243776a1a869895ac66cbc749', salt='x5GBqO6cwMh79/XLFp4wEg==', createAt=1571574255, updateAt=null, createBy=1, updateBy=null}": [],
"Manager{id=3, name='我是坏学生', password='b32d9a77de5139b09e071899e39cdf90', salt='tMPq9pUX/IgMLuTYxLOVcg==', createAt=1571565080, updateAt=null, createBy=1, updateBy=null}": [
{
"id": 22,
"name": "管理员15",
"createAt": 1571492987,
"updateAt": null
},
{
"id": 22,
"name": "管理员15",
"createAt": 1571492987,
"updateAt": null
}
],
"Manager{id=11, name='新增用户', password='a8f7fff03c49b8ba898df5298319c9e4', salt='5kYOE+slMAZ6jpVH4QusAg==', createAt=1571574623, updateAt=null, createBy=1, updateBy=null}": [
{
"id": 29,
"name": "图书管理员",
"createAt": 1571573428,
"updateAt": null
}
],
"Manager{id=9, name='后台管理', password='5d56b700a2c7d6c9bd807a0b73632ea2', salt='Owg2tSrL1VKbhSYGNS2RKQ==', createAt=1571567864, updateAt=null, createBy=1, updateBy=null}": [
{
"id": 3,
"name": "管理员3",
"createAt": 1571476374,
"updateAt": null
}
],
"Manager{id=2, name='liweichuan', password='3be7b7c4cf550f87aa106388ecf2e548', salt='bkzXyC9UmwsB+RKevke2GA==', createAt=1571563933, updateAt=1571569540, createBy=1, updateBy=1}": [
{
"id": 4,
"name": "管理员4",
"createAt": 1571476377,
"updateAt": null
}
],
"Manager{id=12, name='新增一条狗', password='524b724dc65658febacbd751e0a269a9', salt='r1i/Bbz38pcTk3lmVfIQuA==', createAt=1571575734, updateAt=null, createBy=1, updateBy=null}": [
{
"id": 29,
"name": "图书管理员",
"createAt": 1571573428,
"updateAt": null
}
]
},
"managers": {
"pageNum": 0,
"pageSize": 10,
"size": 7,
"startRow": 1,
"endRow": 7,
"total": 7,
"pages": 1,
"list": [
{
"id": 12,
"name": "新增一条狗",
"password": "524b724dc65658febacbd751e0a269a9",
"salt": "r1i/Bbz38pcTk3lmVfIQuA==",
"createAt": 1571575734,
"updateAt": null,
"createBy": 1,
"updateBy": null
},
{
"id": 11,
"name": "新增用户",
"password": "a8f7fff03c49b8ba898df5298319c9e4",
"salt": "5kYOE+slMAZ6jpVH4QusAg==",
"createAt": 1571574623,
"updateAt": null,
"createBy": 1,
"updateBy": null
},
{
"id": 10,
"name": "我是坏学生",
"password": "3f2754b243776a1a869895ac66cbc749",
"salt": "x5GBqO6cwMh79/XLFp4wEg==",
"createAt": 1571574255,
"updateAt": null,
"createBy": 1,
"updateBy": null
},
{
"id": 9,
"name": "后台管理",
"password": "5d56b700a2c7d6c9bd807a0b73632ea2",
"salt": "Owg2tSrL1VKbhSYGNS2RKQ==",
"createAt": 1571567864,
"updateAt": null,
"createBy": 1,
"updateBy": null
},
{
"id": 3,
"name": "我是坏学生",
"password": "b32d9a77de5139b09e071899e39cdf90",
"salt": "tMPq9pUX/IgMLuTYxLOVcg==",
"createAt": 1571565080,
"updateAt": null,
"createBy": 1,
"updateBy": null
},
{
"id": 2,
"name": "liweichuan",
"password": "3be7b7c4cf550f87aa106388ecf2e548",
"salt": "bkzXyC9UmwsB+RKevke2GA==",
"createAt": 1571563933,
"updateAt": 1571569540,
"createBy": 1,
"updateBy": 1
},
{
"id": 1,
"name": "admin",
"password": "0078be3e89625bc3684af8faeb317ca1",
"salt": "yrt1PH2i9xYJa3Rn61OjRg==",
"createAt": 1571288165,
"updateAt": 1571569499,
"createBy": 1,
"updateBy": 1
}
],
"prePage": 0,
"nextPage": 1,
"isFirstPage": false,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1
],
"navigateFirstPage": 1,
"navigateLastPage": 1,
"firstPage": 1,
"lastPage": 1
}
}

这种数据,要我改变给他的数据。这里我需要改变单表查询为连表查询,返回值还不是实体类。分页放在service也可以。连表查询语句可以写,问题是:

返回值用什么封装。



明天计划的事情:(一定要写非常细致的内容)
遇到的问题:(遇到什么困难,怎么解决的)

前端要求我返回为:

一:首先分页,页面显示数都是用的分页插件。肯定会返回这个

"pageNum"0,
"pageSize"10,
"size"7,
"startRow"1,
"endRow"7,
"total"7,
"pages"1,
"list": []
"prePage"0,
"nextPage"1,
"isFirstPage"false,
"isLastPage"false,
"hasPreviousPage"false,
"hasNextPage"true,
"navigatePages"8,
"navigatepageNums": [
1
],
"navigateFirstPage"1,
"navigateLastPage"1,
"firstPage"1,
"lastPage"1
}


二:返回的这个用什么对象封装?



收获:(通过今天的学习,学到了什么知识)


返回列表 返回列表
评论

    分享到