@RequestMapping("/saveOrUpdatePackageType") public String saveOrUpdatePackageType( @ModelAttribute("packageType") PackageType packageType, HttpSession session) { Boolean isContinue = packageType.getContinue(); packageType = packageService.saveOrUpdatePackageType(packageType); if (isContinue) { return "redirect:/package/editPackageType/0"; } return "redirect:/package/packageType"; }
@RequestMapping("/editPackageType/{id}") public String editPackageType( @PathVariable Integer id, @ModelAttribute PackageType packageType, HttpServletRequest request) { packageType.setId(null); if (id != 0) { PackageType tmp = packageService.findPackageTypeByPackageTypeId(id); BeanUtils.copyProperties(tmp, packageType); } return "packageType_edit"; }
@RequestMapping("/editPackages/{id}") public String editPackages( @PathVariable Integer id, @ModelAttribute Packages packages, HttpServletRequest request) { packages.setId(null); if (id != 0) { Packages tmp = packageService.findPackagesByPackageId(id); BeanUtils.copyProperties(tmp, packages); } else { packages.setPackageServicePrice((float) 0.0); } List<PackageType> list = packageService.findAllPackageTypes(); request.setAttribute("packageTypeList", list); try { String uptoken = QiniuHelper.generateUpToken(QiniuHelper.QINIU_BUCKET_IMAGE); request.setAttribute("uptoken", uptoken); } catch (AuthException e) { e.printStackTrace(); } return "packages_edit"; }
@RequestMapping("/deletePackageType/{id}") @ResponseBody public String deletePackageType(@PathVariable Integer id) { packageService.deletePackageType(id); return "success"; }
@RequestMapping("/loadPackageType") @ResponseBody public String loadPackageType() { List<PackageType> list = packageService.findAllPackageTypes(); return JsonUtils.aaData(list); }