Spring boot使用save()方法执行更新时,没有指定的字段在数据库显示为null,什么原因,请指教
@PutMapping(value = "/stu/{id}") public Student stuUpdate(@PathVariable("id") Integer id, @RequestParam("name") String name, @RequestParam("age") Integer age) { Student student = new Student(); student.setId(id); student.setName(name); student.setAge(age); return stuRepository.save(student); }
@Id @GeneratedValue private Integer id; private String name; private Integer age; private String size;
cxxyjsj
相关分类