请选择 进入手机版 | 继续访问电脑版
在线投稿 文字标题 文字标题 文字标题 文字标题 文字标题
切换皮肤
SpringBoot学习笔记五之管理员后台维护
首先完成分页
引入PageHelper(之前已经添加过了)
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F670f7851p00q7szjc001gc000vj00bcm.jpg

在spring-persist-mybatis.xml配置PageHelper插件
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F5f2babe0p00q7szjc003kc0014h00nwm.jpg
找到AdminMapper.xml完成代码
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F9d6bfa1ap00q7szjc000fc0009w0099m.jpg
完成selectAdminByKeyword
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F88e10692p00q7szjc002ic0010m00kcm.jpg
AdminMapper接口中声明方法
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fcd77409ap00q7szjc001lc000uj00ewm.jpg
AdminService接口中添加方法
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fc574dd26p00q7szjc0020c0014c00l6m.jpg
具体实现
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fff5bf494p00q7szjc002yc0019f00mtm.jpg
AdminHandler中添加的方法
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F5f5035a1p00q7szjc004qc0018700obm.jpg
准备admin-page.jsp
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F323cf4d8p00q7szjc000pc000bo00gom.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F4ac6f0abp00q7szjc003ac0011j00iam.jpg
运行查看下
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ff8a46275p00q7szjc0027c001fd00hkm.jpg
分页导航条
加入pagination的环境
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F38265883p00q7szjc000rc000bh00hqm.jpg
引入
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fc4adb245p00q7szjc002ic0014m00d7m.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F02a9103bp00q7szjc003ac000z500nmm.jpg
替换
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fe26a431cp00q7szjc000yc0011z00bim.jpg
有个地方我们注释一下jquery.pagination.js中
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fc9722e4ap00q7szjc0021c000u800mdm.jpg
带上关键字进行查询,在admin-page.jsp中
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F8cbf2362p00q7szjc002hc001ch00ghm.jpg
翻页时保持查询条件
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fadd0ae9cp00q7szjc001mc0018o00djm.jpg
调整删除按钮
代码
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ff501302ap00q7szjc001zc001b000fym.jpg
编辑handler
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F2c15b5c8p00q7szjc0049c0018600ntm.jpg
添加remove方法(service、serviceimpl)
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F20ffe305p00q7szjc000rc000pf0098m.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F141d621fp00q7szjc000zc000sw00bcm.jpg
测试成功
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F87792edfp00q7szjc001ac0015d00dum.jpg
新增
跳转表单页面
之前数据库账户没有加唯一索引,修改下表
ALTER TABLE `t_admin` ADD UNIQUE INDEX(`login_acct`)
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Faafc077cp00q7szjc001nc000gm007bm.jpg
调整按钮admin-page.jsp
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F3411083fp00q7szjc002sc0016d00iom.jpg
添加mvc:view-controller
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fa9d21a7fp00q7szjc002ec0012s00dzm.jpg
添加页面admin-add.jsp
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F692eebc9p00q7szjc000tc000b000hwm.jpg
编写handler方法
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Faffef696p00q7szjc001nc0012f00dmm.jpg
完成service方法
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ff7f802bcp00q7szjc002oc0016o00h9m.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ffbd26a0ap00q7szjc001pc001aw00fam.jpg
添加LoginAcctAlreadyInUseException
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fc49767d0p00q7szjc003ec001cd00nam.jpg
测试下
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ff3750d07p00q7szjc000sc000ol00hem.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F69b569c4p00q7szjc0010c0015g00c8m.jpg
更新和新增的思路一致
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F7773b3ddp00q7szjc001wc0017200fjm.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F95a6d228p00q7szjc000ec000ae00aqm.jpg
重置
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fec79fed3p00q7szjc002wc0013n00i3m.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F753ca882p00q7szjc003gc001b700n8m.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F6996f43ep00q7szjc001vc0013900jtm.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ffe5a0cf3p00q7szjc002nc001d100kcm.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2F12865e0ep00q7szjc003tc001ep00o8m.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Fdb608f86p00q7szjc000rc000pe00gmm.jpg
?url=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0326%2Ff4f52c68p00q7szjc0010c0014h00csm.jpg






回复

使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则


    Archiver|手机版|小黑屋|齐聚无忧 |网站地图

    Powered by Discuz! X3.4  © 2001-2013 Comsenz Inc.