mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
处理idea代码警告
This commit is contained in:
parent
f319e4b7a1
commit
24b1d51155
@ -33,14 +33,14 @@ import static java.util.stream.Collectors.joining;
|
||||
* @author hcl
|
||||
* @since 2016-08-18
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
@SuppressWarnings("unused")
|
||||
public final class MPJStringUtils {
|
||||
|
||||
/**
|
||||
* 判断是否是中文
|
||||
*/
|
||||
public static boolean isChinese(String str) {
|
||||
if(isBlank(str))
|
||||
if (isBlank(str))
|
||||
return false;
|
||||
char c = str.charAt(0);
|
||||
return c >= 0x4E00 && c <= 0x9FA5;
|
||||
@ -70,13 +70,6 @@ public final class MPJStringUtils {
|
||||
*/
|
||||
private static final Pattern CAPITAL_MODE = Pattern.compile("^[0-9A-Z/_]+$");
|
||||
|
||||
/**
|
||||
* 字符串去除空白内容
|
||||
*
|
||||
* <ul> <li>'"<>&*+=#-; sql注入黑名单</li> <li>\n 回车</li> <li>\t 水平制表符</li> <li>\s 空格</li> <li>\r 换行</li> </ul>
|
||||
*/
|
||||
private static final Pattern REPLACE_BLANK = Pattern.compile("'|\"|\\<|\\>|&|\\*|\\+|=|#|-|;|\\s*|\t|\r|\n");
|
||||
|
||||
/**
|
||||
* 判断字符串中是否全是空白字符
|
||||
*
|
||||
@ -99,7 +92,6 @@ public final class MPJStringUtils {
|
||||
* 对象转为字符串去除左右空格
|
||||
*
|
||||
* @param o 带转换对象
|
||||
* @return
|
||||
*/
|
||||
public static String toStringTrim(Object o) {
|
||||
return String.valueOf(o).trim();
|
||||
@ -150,7 +142,7 @@ public final class MPJStringUtils {
|
||||
* @return 字段名
|
||||
*/
|
||||
public static String getTargetColumn(String column) {
|
||||
if(isChinese(column)){
|
||||
if (isChinese(column)) {
|
||||
return column;
|
||||
}
|
||||
if (isNotColumnName(column)) {
|
||||
@ -328,7 +320,7 @@ public final class MPJStringUtils {
|
||||
if (isBlank(concatStr)) {
|
||||
concatStr = StringPool.EMPTY;
|
||||
}
|
||||
if (str == null || str.length() == 0) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -400,33 +392,6 @@ public final class MPJStringUtils {
|
||||
return matches(".*[A-Z]+.*", word) && matches(".*[/_]+.*", word);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否以某个字符串结尾(区分大小写)
|
||||
* Check if a String ends with a specified suffix.
|
||||
* <p>
|
||||
* <code>null</code>s are handled without exceptions. Two <code>null</code>
|
||||
* references are considered to be equal. The comparison is case sensitive.
|
||||
* </p>
|
||||
* <p>
|
||||
* <pre>
|
||||
* StringUtils.endsWith(null, null) = true
|
||||
* StringUtils.endsWith(null, "abcdef") = false
|
||||
* StringUtils.endsWith("def", null) = false
|
||||
* StringUtils.endsWith("def", "abcdef") = true
|
||||
* StringUtils.endsWith("def", "ABCDEF") = false
|
||||
* </pre>
|
||||
* </p>
|
||||
*
|
||||
* @param str the String to check, may be null
|
||||
* @param suffix the suffix to find, may be null
|
||||
* @return <code>true</code> if the String ends with the suffix, case
|
||||
* sensitive, or both <code>null</code>
|
||||
* @see String#endsWith(String)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static boolean endsWith(String str, String suffix) {
|
||||
return endsWith(str, suffix, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a String ends with a specified suffix (optionally case
|
||||
@ -469,10 +434,8 @@ public final class MPJStringUtils {
|
||||
* @return ignore
|
||||
*/
|
||||
public static String prefixToLower(String rawString, int index) {
|
||||
StringBuilder field = new StringBuilder();
|
||||
field.append(rawString.substring(0, index).toLowerCase());
|
||||
field.append(rawString.substring(index));
|
||||
return field.toString();
|
||||
return rawString.substring(0, index).toLowerCase() +
|
||||
rawString.substring(index);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -596,42 +559,4 @@ public final class MPJStringUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL 注入字符串去除空白内容:
|
||||
* <ul>
|
||||
* <li>\n 回车</li>
|
||||
* <li>\t 水平制表符</li>
|
||||
* <li>\s 空格</li>
|
||||
* <li>\r 换行</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param str 字符串
|
||||
*/
|
||||
public static String sqlInjectionReplaceBlank(String str) {
|
||||
if (MPJSqlInjectionUtils.check(str)) {
|
||||
/**
|
||||
* 过滤sql黑名单字符,存在 SQL 注入,去除空白内容
|
||||
*/
|
||||
str = replaceAllBlank(str);
|
||||
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串去除空白内容:
|
||||
* <ul>
|
||||
* <li>\n 回车</li>
|
||||
* <li>\t 水平制表符</li>
|
||||
* <li>\s 空格</li>
|
||||
* <li>\r 换行</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param str 字符串
|
||||
*/
|
||||
public static String replaceAllBlank(String str) {
|
||||
Matcher matcher = REPLACE_BLANK.matcher(str);
|
||||
return matcher.replaceAll("");
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||
*
|
||||
* @since 1.3.12
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
@SuppressWarnings({"unused", "unchecked"})
|
||||
public interface FuncStr<Children, R> extends Serializable {
|
||||
|
||||
/**
|
||||
@ -164,10 +164,10 @@ public interface FuncStr<Children, R> extends Serializable {
|
||||
* <p>例1: gtSql("id", "1, 2, 3, 4, 5, 6")</p>
|
||||
* <p>例1: gtSql("id", "select id from table where name = 'JunJun'")</p>
|
||||
*
|
||||
* @param condition
|
||||
* @param column
|
||||
* @param inValue
|
||||
* @return
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param inValue sql语句
|
||||
* @return children
|
||||
*/
|
||||
Children gtSql(boolean condition, R column, String inValue);
|
||||
|
||||
@ -183,10 +183,10 @@ public interface FuncStr<Children, R> extends Serializable {
|
||||
* <p>例1: geSql("id", "1, 2, 3, 4, 5, 6")</p>
|
||||
* <p>例1: geSql("id", "select id from table where name = 'JunJun'")</p>
|
||||
*
|
||||
* @param condition
|
||||
* @param column
|
||||
* @param inValue
|
||||
* @return
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param inValue sql语句
|
||||
* @return children
|
||||
*/
|
||||
Children geSql(boolean condition, R column, String inValue);
|
||||
|
||||
@ -202,10 +202,10 @@ public interface FuncStr<Children, R> extends Serializable {
|
||||
* <p>例1: ltSql("id", "1, 2, 3, 4, 5, 6")</p>
|
||||
* <p>例1: ltSql("id", "select id from table where name = 'JunJun'")</p>
|
||||
*
|
||||
* @param condition
|
||||
* @param column
|
||||
* @param inValue
|
||||
* @return
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param inValue sql语句
|
||||
* @return children
|
||||
*/
|
||||
Children ltSql(boolean condition, R column, String inValue);
|
||||
|
||||
@ -221,10 +221,10 @@ public interface FuncStr<Children, R> extends Serializable {
|
||||
* <p>例1: leSql("id", "1, 2, 3, 4, 5, 6")</p>
|
||||
* <p>例1: leSql("id", "select id from table where name = 'JunJun'")</p>
|
||||
*
|
||||
* @param condition
|
||||
* @param column
|
||||
* @param inValue
|
||||
* @return
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param inValue sql语句
|
||||
* @return children
|
||||
*/
|
||||
Children leSql(boolean condition, R column, String inValue);
|
||||
|
||||
@ -240,10 +240,10 @@ public interface FuncStr<Children, R> extends Serializable {
|
||||
* <p>例1: eqSql("id", "1, 2, 3, 4, 5, 6")</p>
|
||||
* <p>例1: eqSql("id", "select id from table where name = 'JunJun'")</p>
|
||||
*
|
||||
* @param condition
|
||||
* @param column
|
||||
* @param inValue
|
||||
* @return
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param inValue sql语句
|
||||
* @return children
|
||||
*/
|
||||
Children eqSql(boolean condition, R column, String inValue);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user