@Test public void validatePermisionTest() throws SQLException { LoginUser user = LoginUser.builder().id(1L).build(); PublicStrategy publicStrategy = PublicStrategy.builder().id(1L).name("name").build(); Errors errors = new BeanPropertyBindingResult(publicStrategy, "publicStrategy", true, 256); Assert.assertTrue(publicStrategyService.validatePermision(user, errors).validate().isValid()); }
public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }
PublicStrategyService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); } }
PublicStrategyService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  }
PublicStrategyService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  ValidatorChain validatePermision(LoginUser user, Errors errors); ListResult<PublicStrategyView> findPublicShardingStrategyPageList(Paging<PublicStrategy> paging); boolean isNotExistByName(PublicStrategy publicStrategy); String getStrategyClassName(DatabaseSet databaseSet); }
PublicStrategyService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  ValidatorChain validatePermision(LoginUser user, Errors errors); ListResult<PublicStrategyView> findPublicShardingStrategyPageList(Paging<PublicStrategy> paging); boolean isNotExistByName(PublicStrategy publicStrategy); String getStrategyClassName(DatabaseSet databaseSet);  }