| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | studentVo.setAge(Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday()))); |
| | | listVo.add(studentVo); |
| | | studentVo.setName(tStudent.getName()); |
| | | } |
| | | return ResultUtil.success(listVo); |
| | | }catch (Exception e){ |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/student/queryStudentById") |
| | | public TStudent queryStudentById(@RequestBody Integer id){ |
| | | TStudent student = studentService.getById(id); |
| | | return student; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据名称模糊搜索学员 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/student/queryStudentListByName") |
| | | public List<TStudent> queryStudentListByName(@RequestBody String name){ |
| | | return studentService.list(new QueryWrapper<TStudent>().eq("state", 1).like("name", name)); |
| | | } |
| | | } |