/** * 删除 * * @param param * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/delete", method = RequestMethod.POST) public JsonMessage delete(ClientParameter param) throws Exception { Map<String, String> map = ParameterUtils.getMapFromParameter(param); articleCateService.delete(MapUtils.getString(map, "refrenceId")); return super.getJsonMessage(ClientConst.SUCCESS); }
/** * 查询详情 * * @param param * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/view", method = RequestMethod.POST) public JsonMessage view(ClientParameter param) throws Exception { Map<String, String> map = ParameterUtils.getMapFromParameter(param); ArticleCate articleCate = articleCateService.selectByPrimaryKey(MapUtils.getString(map, "refrenceId")); if (null == articleCate) { return super.getJsonMessage(ClientConst.DBERROR); } return super.getJsonMessage(ClientConst.SUCCESS, articleCate); }
/** * 新增/修改 * * @param param * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/save", method = RequestMethod.POST) public JsonMessage save(ClientParameter param) throws Exception { Map<String, String> map = ParameterUtils.getMapFromParameter(param); ArticleCate articleCate = new ArticleCate(); BeanUtils.populate(articleCate, map); JsonMessage jsonMessage = super.getJsonMessage(ClientConst.SUCCESS); if (beanValidator(jsonMessage, articleCate)) { if (StringUtils.isNotBlank(articleCate.getCateIcon()) && (articleCate.getCateIcon().startsWith(ImageConst.File_SEPARATOR + ImageConst.TEMP) || articleCate.getCateIcon().startsWith(ImageConst.TEMP))) { String articleImage = FileClientUtil.moveAndDeleteFile( ImageConst.COMMON_IMG_PATH, articleCate.getCateIcon(), ""); articleCate.setCateIcon(articleImage); } articleCateService.saveByClient(articleCate); } return jsonMessage; }
/** * 查询 * * @return JsonMessage * @throws Exception */ @ResponseBody @RequestMapping(value = "/search") public JsonMessage search() throws Exception { TreeSet<ArticleCate> result = articleCateService.listTop(); return getJsonMessage(ClientConst.SUCCESS, result); }