@Test public void delete() throws Exception { mockMvc.perform(MockMvcRequestBuilders.delete("/selectEntity/delete") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
@RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = selectEntityService.validatePermision(user, taskSql, errors) .addAssert(() -> selectEntityDao.deleteTask(taskSql) > 0, message.db_message_delete_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }
SelectEntityController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = selectEntityService.validatePermision(user, taskSql, errors) .addAssert(() -> selectEntityDao.deleteTask(taskSql) > 0, message.db_message_delete_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); } }
SelectEntityController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = selectEntityService.validatePermision(user, taskSql, errors) .addAssert(() -> selectEntityDao.deleteTask(taskSql) > 0, message.db_message_delete_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  }
SelectEntityController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = selectEntityService.validatePermision(user, taskSql, errors) .addAssert(() -> selectEntityDao.deleteTask(taskSql) > 0, message.db_message_delete_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<TaskSqlView>> list(@RequestBody Paging<TaskSql> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors); }
SelectEntityController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = selectEntityService.validatePermision(user, taskSql, errors) .addAssert(() -> selectEntityDao.deleteTask(taskSql) > 0, message.db_message_delete_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<TaskSqlView>> list(@RequestBody Paging<TaskSql> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteSelectEntity.class) @RequestBody TaskSql taskSql, @CurrentUser LoginUser user, Errors errors);  }