mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-30 09:48:43 +08:00 
			
		
		
		
	v3.7.0 参数管理支持配置验证码开关
This commit is contained in:
		| @@ -1,8 +1,13 @@ | ||||
| package cn.iocoder.yudao.framework.common.util.validation; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import org.springframework.util.StringUtils; | ||||
|  | ||||
| import javax.validation.ConstraintViolation; | ||||
| import javax.validation.ConstraintViolationException; | ||||
| import javax.validation.Validator; | ||||
| import java.util.Set; | ||||
| import java.util.regex.Pattern; | ||||
|  | ||||
| /** | ||||
| @@ -34,4 +39,11 @@ public class ValidationUtils { | ||||
|                 && PATTERN_XML_NCNAME.matcher(str).matches(); | ||||
|     } | ||||
|  | ||||
|     public static void validate(Validator validator, Object reqVO, Class<?>... groups) { | ||||
|         Set<ConstraintViolation<Object>> constraintViolations = validator.validate(reqVO, groups); | ||||
|         if (CollUtil.isNotEmpty(constraintViolations)) { | ||||
|             throw new ConstraintViolationException(constraintViolations); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV