当前位置:网站首页>用户信息管理的功能开发
用户信息管理的功能开发
2022-06-11 18:19:00 【C_x_330】
后台登陆功能开发
需求分析
代码开发
功能测试
后台退出功能开发
需求分析
代码开发
功能测试
完善后台登陆功能
当用户没登陆时先登录
使用过滤器/拦截器
过滤器
- 如何创建过滤器
- 先创建一个类
- 加上注解@WebFilter(filtername=" 这个和类名一样就行",urlPatterns=“/*”)
- 实现接口 Filter
- 重写方法 一般写 doFilter 方法就可以
- 在启动类上再加一个注解 @ServletComponentScan
实现逻辑
新增员工
员工信息分页查询
- 如何配置MybatisPlus的分页插件?
@Configuration public class MybatisPlusConfig { @Bean public MybatisPlusInterceptor mybatisPlusInterceptor(){ MybatisPlusInterceptor mpi = new MybatisPlusInterceptor(); mpi.addInnerInterceptor(new PaginationInnerInterceptor()); return mpi; } }
@GetMapping("/page") public R<Page> page(int page,int pageSize,String name){ log.info("page= {}, pageSize= {}, name= {}",page,pageSize,name); //构造分页构造器 Page pageinfo= new Page(page,pageSize); //构造条件构造器 LambdaQueryWrapper<Employee> lqw=new LambdaQueryWrapper(); lqw.like(StringUtils.isNotEmpty(name),Employee::getName,name); //添加排序条件 按更新时间 lqw.orderByAsc(Employee::getUpdateTime); //执行查询 employeeService.page(pageinfo,lqw); return R.success(pageinfo); }
启用禁用员工账号
- Js对Long型数据处理时丢失精度,导致提交的id和数据库中的id不一致
- 解决方法
- 我们再给服务器响应Json数据时,统一将Long型数据转换为字符串数据进行处理
编辑员工信息
- 回显员工信息
@GetMapping("/{id}") public R<Employee> edit(@PathVariable Long id){ log.info("根据id查询员工信息"); Employee emp = employeeService.getById(id); if(emp!=null){ return R.success(emp); } return R.error("编辑失败"); }
- 有个小细节: @GetMapping(“/{id}”)
- 这个"/{id}" 前面不要误加 "/${id}"不要搞混了
边栏推荐
猜你喜欢

Map and set

Force deduction questions -- create a string based on a binary tree

TI AM64x——最新16nm处理平台,专为工业网关、工业机器人而生

TR-069协议介绍

Non recursive traversal of binary tree

Surveillance des fonctions de perte avec visdom

Quanzhi technology T3 development board (4-core arm cortex-a7) - mqtt communication protocol case

使用mysql判断日期是星期几

DC-DC自举电容(BOOT)几个问题

VIM common commands
随机推荐
Common operations of Visio
MMA-Self-defining function
Several commands related to domain name
软件测试技术复习
求字符串中最大的 3 位相同数字
Quanzhi T3 development board (4-core arm cortex-a7) - detailed explanation of logo display during system startup
Oracle高级数据库复习
力扣刷题——根据二叉树创建字符串
Signal processing and capture
Easycwmp source code analysis
牛客刷题——part7
Quanzhi technology T3 development board (4-core arm cortex-a7) - mqtt communication protocol case
[C语言]限制查找次数,输出次数内查找到的最大值
*Use of jetpack notes room
Niu Ke's questions -- two sorting methods
[c language] compress strings and add markup characters
ubuntu 安装psql以及运行相关命令
labelme进行图片数据标注
On the sequence traversal of binary tree Ⅱ
Force buckle 31 next arrangement