以下是我的控制器类。更新未发生,每次更新新记录时都会创建。我正在使用Thymeleaf模板。我做错了吗?
SystemConfigController.java
@Controller
@RequestMapping("/systemconfig")
public class SystemConfigController {
@Autowired
private SystemConfigService systemConfigService;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String findAll(Model model) {
model.addAttribute("config", systemConfigService.findAll());
return "systemconfig";
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String saveSystemConfig(SystemConfig systemConfig) {
this.systemConfigService.save(systemConfig);
return "redirect:/systemconfig/";
}
@RequestMapping("/edit/{id}")
public String editSystemConfig(@PathVariable("id") Integer schemaId, Model model) {
model.addAttribute("config", this.systemConfigService.findOne(schemaId));
return "addsystemconfig";
}
@RequestMapping("/view/{id}")
public String viewSystemConfig(@PathVariable("id") Integer schemaId, Model model) {
model.addAttribute("config", this.systemConfigService.findOne(schemaId));
return "viewsystemconfig";
}
@RequestMapping("/delete/{id}")
public String delete(@PathVariable("id") Integer schemaId, Model model) {
this.systemConfigService.delete(schemaId);
return "redirect:/systemconfig/";
}
}