/** 卸载 */ @RequestMapping(value = "/uninstall", method = RequestMethod.POST) public @ResponseBody Result uninstall() { if (plugin.getIsInstalled()) { PluginConfig pluginConfig = plugin.getPluginConfig(); pluginConfigService.delete(pluginConfig); } return Result.success(); }
/** 安装 */ @RequestMapping(value = "/install", method = RequestMethod.POST) public @ResponseBody Result install() { if (!plugin.getIsInstalled()) { PluginConfig pluginConfig = pluginConfigService.newEntity(); pluginConfig.setPluginId(plugin.getId()); pluginConfig.setIsEnabled(false); pluginConfigService.save(pluginConfig); } return Result.success(); }
/** 更新 */ @RequestMapping(value = "/update", method = RequestMethod.POST) public @ResponseBody Result update( @ModelAttribute("pluginConfig") @Valid PluginConfig pluginConfig, BindingResult result, Model model) { preUpdate(pluginConfig, result, model); if (result.hasErrors()) { return Result.validateError(result.getAllErrors()); } pluginConfigService.save(pluginConfig); return Result.success(); }