- 2023-03-21EmployeeController里的login方法写法
参数:HttpServletRequest是为了登录成功后,将员工id存入session,@RequestBody是为了接收前端的json数据,前端点击登录时f12显示的是username和password得和后端实体类的字段一
- 2023-03-20EmployeeController类的分页查询page方法
@GetMapping("/page")publicR<Page>page(intpage,intpageSize,Stringname){log.info("page={},pageSize={},name={}",page,pageSize,name);//构造分页
- 2023-03-20EmployeeController类的根据id修改员工信息update方法
@PutMappingpublicR<String>update(HttpServletRequestrequest,@RequestBodyEmployeeemployee){log.info(employee.toString());//获取当前登录用户id/
- 2023-03-20EmployeeController类的根据id查询员工信息getById方法
@GetMapping("/{id}")publicR<Employee>getById(@PathVariableLongid){log.info("根据id查询员工信息。。。");Employeeemployee=employeeService.getById
- 2023-03-20EmployeeController类的新增员工save方法
@PostMappingpublicR<String>save(HttpServletRequestrequest,@RequestBodyEmployeeemployee){log.info("新增员工,员工信息:{}",employee.toString());//初
- 2023-03-20EmployeeController类的声明
注解:@Slf4j@RestController@RequestMapping("/employee")注入service:@AutowiredprivateEmployeeServiceemployeeService;===========================================
- 2023-03-20EmployeeController类的登录login方法
@PostMapping("/login")publicR<Employee>login(HttpServletRequestrequest,@RequestBodyEmployeeemployee){//1、将页面提交的密码password进行md5加密处理