update ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java.

添加String转换Boolean值时对(是、否)的支持

Signed-off-by: 程子 <395030787@qq.com>
This commit is contained in:
程子 2025-03-03 08:04:15 +00:00 committed by Gitee
parent 193c256e71
commit 6e314dd3e8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -541,7 +541,7 @@ public class Convert
/** /**
* 转换为boolean<br> * 转换为boolean<br>
* String支持的值为truefalseyesokno1,0 如果给定的值为空或者转换失败返回默认值<br> * String支持的值为truefalseyesokno10, 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错 * 转换失败不会报错
* *
* @param value 被转换的值 * @param value 被转换的值
@ -570,10 +570,12 @@ public class Convert
case "yes": case "yes":
case "ok": case "ok":
case "1": case "1":
case "":
return true; return true;
case "false": case "false":
case "no": case "no":
case "0": case "0":
case "":
return false; return false;
default: default:
return defaultValue; return defaultValue;