@RequiresPermissions(value = "cartype:save") @RequestMapping(value = "/save", method = RequestMethod.POST) public String editCarType( CarType carType, BindingResult bindingResult, @RequestParam(value = "file") MultipartFile file, HttpSession httpSession) { if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) { System.out.println(error.getObjectName() + " : " + error.getDefaultMessage()); } } carTypeService.updateCarType(carType, file, httpSession); return "redirect:/admin/cartype/list"; }
/** * 删除车型 * * @param id * @return */ @RequiresPermissions(value = "cartype:delete") @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE) public String deleteCarType(@PathVariable("id") int id) { carTypeService.deleteEntityById(id); return "redirect:/admin/cartype/list"; }
/** * 编辑车型 * * @param id * @param map * @return */ @RequiresPermissions(value = "cartype:update") @RequestMapping(value = "/edit/{id}", method = RequestMethod.GET) public String editCarType(@PathVariable("id") int id, Map<String, Object> map) { map.put("carType", carTypeService.getEntity(id)); return "cartype/edit"; }
/** * 车型列表 * * @param pageNo * @param map * @return */ @RequiresPermissions(value = "cartype:query") @RequestMapping(value = "/list", method = RequestMethod.GET) public String getCarTypes(Map<String, Object> map) { map.put("carTypes", carTypeService.findAllEntities()); return "cartype/list"; }