org.springframework.validation.BindingResult Java Examples

The following examples show how to use org.springframework.validation.BindingResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MarshallingViewTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void renderNoModelKeyAndBindingResultFirst() throws Exception {
	Object toBeMarshalled = new Object();
	String modelKey = "key";
	Map<String, Object> model = new LinkedHashMap<>();
	model.put(BindingResult.MODEL_KEY_PREFIX + modelKey, new BeanPropertyBindingResult(toBeMarshalled, modelKey));
	model.put(modelKey, toBeMarshalled);

	MockHttpServletRequest request = new MockHttpServletRequest();
	MockHttpServletResponse response = new MockHttpServletResponse();

	given(marshallerMock.supports(BeanPropertyBindingResult.class)).willReturn(true);
	given(marshallerMock.supports(Object.class)).willReturn(true);

	view.render(model, request, response);
	assertEquals("Invalid content type", "application/xml", response.getContentType());
	assertEquals("Invalid content length", 0, response.getContentLength());
	verify(marshallerMock).marshal(eq(toBeMarshalled), isA(StreamResult.class));
}
 
Example #2
Source File: EntityValidator.java    From entando-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void validateBodyName(String id, EntityDto request, BindingResult bindingResult) {
    if (!StringUtils.equals(id, request.getId())) {
        bindingResult.rejectValue("id", ERRCODE_URINAME_MISMATCH, new String[]{id, request.getId()}, "entity.id.mismatch");
        throw new ValidationConflictException(bindingResult);
    }
    if (!this.existEntity(id)) {
        bindingResult.reject(ERRCODE_ENTITY_DOES_NOT_EXIST, new String[]{id}, "entity.notExists");
        throw new ResourceNotFoundException(bindingResult);
    }
}
 
Example #3
Source File: FileBrowserService.java    From entando-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void addFile(FileBrowserFileRequest request, BindingResult bindingResult) {
    String path = request.getPath();
    String parentFolder = path.substring(0, path.lastIndexOf("/"));
    this.checkResource(parentFolder, "Parent Folder", request.isProtectedFolder());
    try {
        if (this.getStorageManager().exists(request.getPath(), request.isProtectedFolder())) {
            bindingResult.reject(FileBrowserValidator.ERRCODE_RESOURCE_ALREADY_EXIST,
                    new String[]{request.getPath(), String.valueOf(request.isProtectedFolder())}, "fileBrowser.file.exists");
            throw new ValidationConflictException(bindingResult);
        }
        InputStream is = new ByteArrayInputStream(request.getBase64());
        this.getStorageManager().saveFile(path, request.isProtectedFolder(), is);
    } catch (ValidationConflictException vge) {
        throw vge;
    } catch (Throwable t) {
        logger.error("error adding file path {} - type {}", path, request.isProtectedFolder());
        throw new RestServerError("error adding file", t);
    }
}
 
Example #4
Source File: HomeController.java    From Asqatasun with GNU Affero General Public License v3.0 6 votes vote down vote up
@RequestMapping(value=TgolKeyStore.HOME_URL, method = RequestMethod.POST)
@Secured({TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY})
protected String submitForm(
        @ModelAttribute(TgolKeyStore.CONTRACT_SORT_COMMAND_KEY) ContractSortCommand contractDisplayCommand,
        BindingResult result,
        Model model,
        HttpServletRequest request) {
    User user = getCurrentUser();
    if (!user.getId().equals(contractDisplayCommand.getUserId())) {
        throw new ForbiddenUserException();
    }
    // The page is displayed with sort option. Form needs to be set up
    model.addAttribute(
            TgolKeyStore.CONTRACT_LIST_KEY, 
            ContractSortCommandHelper.prepareContractInfo(
                user, 
                contractDisplayCommand,
                displayOptionFieldsBuilderList,
                model));
    return TgolKeyStore.HOME_VIEW_NAME;
}
 
Example #5
Source File: EmailAdminController.java    From FlyCms with MIT License 6 votes vote down vote up
@PostMapping("/email_templets_update")
@ResponseBody
public DataVo updateEmailTemplets(@Valid Email email, BindingResult result){
    DataVo data = DataVo.failure("操作失败");
    try {
        if (result.hasErrors()) {
            List<ObjectError> list = result.getAllErrors();
            for (ObjectError error : list) {
                return DataVo.failure(error.getDefaultMessage());
            }
            return null;
        }
        data = emailService.updateEmailTempletsById(email);
    } catch (Exception e) {
        data = DataVo.failure(e.getMessage());
    }
    return data;
}
 
Example #6
Source File: WidgetController.java    From attic-rave with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/admin/widgetdetail/update", method = RequestMethod.POST)
public String updateWidgetDetail(@ModelAttribute(ModelKeys.WIDGET) Widget widget, BindingResult result,
                                 @ModelAttribute(ModelKeys.TOKENCHECK) String sessionToken,
                                 @RequestParam String token,
                                 @RequestParam(required = false) String referringPageId,
                                 ModelMap modelMap,
                                 SessionStatus status) {
    checkTokens(sessionToken, token, status);
    widgetValidator.validate(widget, result);
    if (result.hasErrors()) {
        addNavigationMenusToModel(SELECTED_ITEM, (Model) modelMap, referringPageId);
        modelMap.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
        modelMap.addAttribute(ModelKeys.CATEGORIES, categoryService.getAllList());
        return ViewNames.ADMIN_WIDGETDETAIL;
    }
    widgetService.updateWidget(widget);
    modelMap.clear();
    status.setComplete();
    return "redirect:/app/admin/widgets?action=update&referringPageId=" + referringPageId;
}
 
Example #7
Source File: SelectTagTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void withListAndEditor() throws Exception {
	this.tag.setPath("realCountry");
	this.tag.setItems(Country.getCountries());
	this.tag.setItemValue("isoCode");
	this.tag.setItemLabel("name");
	BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(getTestBean(), "testBean");
	bindingResult.getPropertyAccessor().registerCustomEditor(Country.class, new PropertyEditorSupport() {
		@Override
		public void setAsText(String text) throws IllegalArgumentException {
			setValue(Country.getCountryWithIsoCode(text));
		}
		@Override
		public String getAsText() {
			return ((Country) getValue()).getName();
		}
	});
	getPageContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "testBean", bindingResult);
	this.tag.doStartTag();
	String output = getOutput();
	assertTrue(output.startsWith("<select "));
	assertTrue(output.endsWith("</select>"));
	assertTrue(output.contains("option value=\"AT\" selected=\"selected\">Austria"));
}
 
Example #8
Source File: MappingJackson2XmlViewTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void renderSimpleBeanWithJsonView() throws Exception {
	Object bean = new TestBeanSimple();
	Map<String, Object> model = new HashMap<>();
	model.put("bindingResult", mock(BindingResult.class, "binding_result"));
	model.put("foo", bean);
	model.put(JsonView.class.getName(), MyJacksonView1.class);

	view.setUpdateContentLength(true);
	view.render(model, request, response);

	String content = response.getContentAsString();
	assertTrue(content.length() > 0);
	assertEquals(content.length(), response.getContentLength());
	assertTrue(content.contains("foo"));
	assertFalse(content.contains("boo"));
	assertFalse(content.contains(JsonView.class.getName()));
}
 
Example #9
Source File: DemoController.java    From mall-swarm with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "更新品牌")
@RequestMapping(value = "/brand/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateBrand(@PathVariable("id") Long id, @Validated @RequestBody PmsBrandDto pmsBrandDto,BindingResult result) {
    if(result.hasErrors()){
        return CommonResult.validateFailed(result.getFieldError().getDefaultMessage());
    }
    CommonResult commonResult;
    int count = demoService.updateBrand(id, pmsBrandDto);
    if (count == 1) {
        commonResult = CommonResult.success(pmsBrandDto);
        LOGGER.debug("updateBrand success:{}", pmsBrandDto);
    } else {
        commonResult = CommonResult.failed("操作失败");
        LOGGER.debug("updateBrand failed:{}", pmsBrandDto);
    }
    return commonResult;
}
 
Example #10
Source File: PosterController.java    From poster-generater with MIT License 6 votes vote down vote up
/**
 * 画图并上传
 *
 * @param poster
 * @return Result
 */
@RequestMapping(method = RequestMethod.POST, path = "/poster")
Result drawAndUpload(@RequestBody @Valid Poster poster, BindingResult bindingResult) {
    if (bindingResult.hasErrors()) {
        return new BlankResult("error", Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
    }

    try {
        // 从 数据中心获取结果,如果有,直接返回
        Result result = data.find(poster.key());
        if (result != null) {
            return result;
        }

        // 如果没有,则画图并上传后存储到数据中心
        result = uploader.upload(poster.draw());

        if (result.isSuccessful()) {
            data.save(poster.key(), result);
        }
        return result;
    } catch (Exception e) {
        e.printStackTrace();
        return new BlankResult("error", e.getMessage());
    }
}
 
Example #11
Source File: ModelFactoryTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void updateModelBindingResult() throws Exception {
	String commandName = "attr1";
	Object command = new Object();
	ModelAndViewContainer container = new ModelAndViewContainer();
	container.addAttribute(commandName, command);

	WebDataBinder dataBinder = new WebDataBinder(command, commandName);
	WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
	given(binderFactory.createBinder(this.webRequest, command, commandName)).willReturn(dataBinder);

	ModelFactory modelFactory = new ModelFactory(null, binderFactory, this.attributeHandler);
	modelFactory.updateModel(this.webRequest, container);

	assertEquals(command, container.getModel().get(commandName));
	String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + commandName;
	assertSame(dataBinder.getBindingResult(), container.getModel().get(bindingResultKey));
	assertEquals(2, container.getModel().size());
}
 
Example #12
Source File: ExceptionTranslator.java    From java-microservices-examples with Apache License 2.0 6 votes vote down vote up
@Override
public ResponseEntity<Problem> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) {
    BindingResult result = ex.getBindingResult();
    List<FieldErrorVM> fieldErrors = result.getFieldErrors().stream()
        .map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode()))
        .collect(Collectors.toList());

    Problem problem = Problem.builder()
        .withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE)
        .withTitle("Method argument not valid")
        .withStatus(defaultConstraintViolationStatus())
        .with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION)
        .with(FIELD_ERRORS_KEY, fieldErrors)
        .build();
    return create(ex, problem, request);
}
 
Example #13
Source File: AuditResultController.java    From Asqatasun with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 *
 * @param auditResultSortCommand
 * @param webresourceId
 * @param result
 * @param model
 * @param request
 * @return
 */
@RequestMapping(value = {TgolKeyStore.CONTRACT_VIEW_NAME_REDIRECT, TgolKeyStore.PAGE_RESULT_CONTRACT_URL}, method = RequestMethod.POST)
@Secured({TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY})
protected String submitPageResultSorter(
        @ModelAttribute(TgolKeyStore.AUDIT_RESULT_SORT_COMMAND_KEY) AuditResultSortCommand auditResultSortCommand,
        @RequestParam(TgolKeyStore.WEBRESOURCE_ID_KEY) String webresourceId,
        BindingResult result,
        Model model,
        HttpServletRequest request) {
    return dispatchDisplayResultRequest(
            auditResultSortCommand.getWebResourceId(),
            auditResultSortCommand,
            model,
            request,
            false,
            null);
}
 
Example #14
Source File: ModelResultMatchers.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Assert a field error code for a model attribute using a {@link org.hamcrest.Matcher}.
 * @since 4.1
 */
public <T> ResultMatcher attributeHasFieldErrorCode(final String name, final String fieldName,
		final Matcher<? super String> matcher) {

	return mvcResult -> {
		ModelAndView mav = getModelAndView(mvcResult);
		BindingResult result = getBindingResult(mav, name);
		assertTrue("No errors for attribute: [" + name + "]", result.hasErrors());
		FieldError fieldError = result.getFieldError(fieldName);
		if (fieldError == null) {
			fail("No errors for field '" + fieldName + "' of attribute '" + name + "'");
		}
		String code = fieldError.getCode();
		assertThat("Field name '" + fieldName + "' of attribute '" + name + "'", code, matcher);
	};
}
 
Example #15
Source File: AdminLoginController.java    From Spring-MVC-Blueprints with MIT License 6 votes vote down vote up
@RequestMapping(method=RequestMethod.POST)
public RedirectView submitForm(Model model, @Validated @ModelAttribute LoginForm adminLoginForm, BindingResult bindingResult){
	model.addAttribute("adminLoginForm", adminLoginForm);
	RedirectView redirectView = new RedirectView();
	redirectView.setContextRelative(true);
	
	if(bindingResult.hasErrors()) {
		adminLoginForm = new LoginForm();
		redirectView.setUrl("/smp/admin_login.html");
		model.addAttribute("adminLoginForm", adminLoginForm);
	} else{
		Login login = new Login();
		login.setUserName(adminLoginForm.getUsername());
		login.setPassWord(adminLoginForm.getPassword());
		if(loginService.isAdminUser(login)){
			redirectView.setUrl("/smp/admin_pending.html");
		}else{
			adminLoginForm = new LoginForm();
			redirectView.setUrl("/smp/admin_login.html");
		}
	}
	return redirectView;
}
 
Example #16
Source File: MappingJackson2XmlViewTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void renderSimpleMap() throws Exception {
	Map<String, Object> model = new HashMap<String, Object>();
	model.put("bindingResult", mock(BindingResult.class, "binding_result"));
	model.put("foo", "bar");

	view.setUpdateContentLength(true);
	view.render(model, request, response);

	assertEquals("no-store", response.getHeader("Cache-Control"));

	assertEquals(MappingJackson2XmlView.DEFAULT_CONTENT_TYPE, response.getContentType());

	String jsonResult = response.getContentAsString();
	assertTrue(jsonResult.length() > 0);
	assertEquals(jsonResult.length(), response.getContentLength());

	validateResult();
}
 
Example #17
Source File: CheckboxTagTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void withSingleValueAndEditor() throws Exception {
	this.bean.setName("Rob Harrop");
	this.tag.setPath("name");
	this.tag.setValue("   Rob Harrop");
	BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(this.bean, COMMAND_NAME);
	bindingResult.getPropertyEditorRegistry().registerCustomEditor(String.class, new StringTrimmerEditor(false));
	getPageContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, bindingResult);

	int result = this.tag.doStartTag();
	assertEquals(Tag.SKIP_BODY, result);

	String output = getOutput();

	// wrap the output so it is valid XML
	output = "<doc>" + output + "</doc>";

	SAXReader reader = new SAXReader();
	Document document = reader.read(new StringReader(output));
	Element checkboxElement = (Element) document.getRootElement().elements().get(0);
	assertEquals("input", checkboxElement.getName());
	assertEquals("checkbox", checkboxElement.attribute("type").getValue());
	assertEquals("name", checkboxElement.attribute("name").getValue());
	assertEquals("checked", checkboxElement.attribute("checked").getValue());
	assertEquals("   Rob Harrop", checkboxElement.attribute("value").getValue());
}
 
Example #18
Source File: OwnerController.java    From activejpa with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/owners", method = RequestMethod.GET)
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {

    // allow parameterless GET request for /owners to return all records
    if (owner.getLastName() == null) {
        owner.setLastName(""); // empty string signifies broadest possible search
    }

    // find owners by last name
    Collection<Owner> results = this.clinicService.findOwnerByLastName(owner.getLastName());
    if (results.size() < 1) {
        // no owners found
        result.rejectValue("lastName", "notFound", "not found");
        return "owners/findOwners";
    }
    if (results.size() > 1) {
        // multiple owners found
        model.put("selections", results);
        return "owners/ownersList";
    } else {
        // 1 owner found
        owner = results.iterator().next();
        return "redirect:/owners/" + owner.getId();
    }
}
 
Example #19
Source File: AdminOtcCoinController.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
@RequiresPermissions("otc:otc-coin:update")
@PostMapping("update")
@AccessLog(module = AdminModule.OTC, operation = "更新otc币种otcCoin")
public MessageResult update(@Valid OtcCoin otcCoin, BindingResult bindingResult) {
    notNull(otcCoin.getId(), "validate otcCoin.id!");
    MessageResult result = BindingResultUtil.validate(bindingResult);
    if (result != null) {
        return result;
    }
    OtcCoin one = otcCoinService.findOne(otcCoin.getId());
    notNull(one, "validate otcCoin.id!");
    otcCoinService.save(otcCoin);
    return success();
}
 
Example #20
Source File: TemplateController.java    From abixen-platform with GNU Lesser General Public License v2.1 5 votes vote down vote up
@RequestMapping(value = "", method = RequestMethod.POST)
public FormValidationResultRepresentation<TemplateForm> createTemplate(@RequestBody @Valid TemplateForm templateForm, BindingResult bindingResult) {
    if (bindingResult.hasErrors()) {
        List<FormErrorRepresentation> formErrors = ValidationUtil.extractFormErrors(bindingResult);
        return new FormValidationResultRepresentation<>(templateForm, formErrors);
    }

    templateManagementService.createTemplate(templateForm);

    return new FormValidationResultRepresentation<>(templateForm);
}
 
Example #21
Source File: NotificationController.java    From production-ready-microservices-starter with MIT License 5 votes vote down vote up
@PostMapping
public ResponseEntity<IdentityResponse> createNotification(
        @RequestBody @Valid NotificationCreateRequest notificationCreateRequest, BindingResult bindingResult) {

    if (bindingResult.hasErrors()) {
        throw new ValidationException(bindingResult);
    }

    return new ResponseEntity(notificationService.create(notificationCreateRequest), HttpStatus.CREATED);
}
 
Example #22
Source File: RegisterController.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * 手机注册暂时关闭
 * @param loginByPhone
 * @param bindingResult
 * @param request
 * @return
 * @throws Exception
 */
@RequestMapping("/register/for_phone")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public MessageResult loginByPhone4Mobiles(
        @Valid LoginByPhone loginByPhone,
        BindingResult bindingResult,HttpServletRequest request) throws Exception {
    log.info("============请到PC端注册---registerPC");
    return error(localeMessageSourceService.getMessage("REGISTER_TO_PC"));
}
 
Example #23
Source File: UserController.java    From springboot-learn with MIT License 5 votes vote down vote up
@ApiOperation(value = "新增", notes = "新增", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@PostMapping("/save")
public Result save(@Valid @RequestBody User user, BindingResult bindingResult) {
    if (bindingResult.hasErrors()) {
        return Result.error(bindingResult.getFieldError().getDefaultMessage());
    }
    user.setRegisterIp(getIpAddr());
    return userService.insert(user);
}
 
Example #24
Source File: PictureSortRestApi.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
@AuthorityVerify
@OperationLogger(value = "编辑图片分类")
@ApiOperation(value = "编辑图片分类", notes = "编辑图片分类", response = String.class)
@PostMapping("/edit")
public String edit(@Validated({Update.class}) @RequestBody PictureSortVO pictureSortVO, BindingResult result) {

    // 参数校验
    ThrowableUtils.checkParamArgument(result);
    return pictureSortService.editPictureSort(pictureSortVO);
}
 
Example #25
Source File: PmsProductCategoryController.java    From xmall with MIT License 5 votes vote down vote up
@ApiOperation("添加产品分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:create')")
public Object create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam,
                     BindingResult result) {
    int count = productCategoryService.create(productCategoryParam);
    if (count > 0) {
        return new CommonResult().success(count);
    } else {
        return new CommonResult().failed();
    }
}
 
Example #26
Source File: FastJsonJsonView.java    From letv with Apache License 2.0 5 votes vote down vote up
protected Object filterModel(Map<String, Object> model) {
    Map<String, Object> result = new HashMap(model.size());
    Set<String> renderedAttributes = !CollectionUtils.isEmpty(this.renderedAttributes) ? this.renderedAttributes : model.keySet();
    for (Entry<String, Object> entry : model.entrySet()) {
        if (!(entry.getValue() instanceof BindingResult) && renderedAttributes.contains(entry.getKey())) {
            result.put(entry.getKey(), entry.getValue());
        }
    }
    return result;
}
 
Example #27
Source File: DmsRegistrationDistributionController.java    From HIS with Apache License 2.0 5 votes vote down vote up
@HystrixCommand(fallbackMethod = "createRegistrationFallbackInfo")
@ApiOperation(value = "挂号")
@RequestMapping(value = "/createRegistration", method = RequestMethod.POST)
@ResponseBody
public CommonResult createRegistration(@RequestBody DmsRegistrationParam dmsRegistrationParam , BindingResult result){
   return apiPcDmsRegistrationDistributionService.createRegistration(dmsRegistrationParam);

}
 
Example #28
Source File: CommentRestController.java    From wallride with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public CommentSavedModel update(
		@PathVariable long id,
		@Validated CommentForm form,
		BindingResult result,
		AuthorizedUser authorizedUser) throws BindException {
	if (result.hasFieldErrors("content")) {
		throw new BindException(result);
	}
	CommentUpdateRequest request = form.toCommentUpdateRequest(id);
	Comment comment = commentService.updateComment(request, authorizedUser);
	return new CommentSavedModel(comment);
}
 
Example #29
Source File: UifComponentsTestController.java    From rice with Educational Community License v2.0 5 votes vote down vote up
/**
 * Generates a fake incident report to test for errorCallback
 *
 * @return ModelAndView model and view
 */
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=errorCheck")
public ModelAndView errorCheck(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response) {

    if (true) {
        throw new RuntimeException("Generate fake incident report");
    }

    return getModelAndView(form);
}
 
Example #30
Source File: CategoryMenuRestApi.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
/**
 * 如果是一级菜单,直接置顶在最前面,二级菜单,就在一级菜单内置顶
 *
 * @author [email protected]
 * @date 2018年11月29日上午9:22:59
 */
@AuthorityVerify
@OperationLogger(value = "置顶菜单")
@ApiOperation(value = "置顶菜单", notes = "置顶菜单", response = String.class)
@PostMapping("/stick")
public String stick(@Validated({Delete.class}) @RequestBody CategoryMenuVO categoryMenuVO, BindingResult result) {

    // 参数校验
    ThrowableUtils.checkParamArgument(result);
    return categoryMenuService.stickCategoryMenu(categoryMenuVO);
}