| | |
| | | |
| | | import com.lf.server.entity.all.StaticData; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取 like 字符串-2 |
| | | * 获取 like 字符串 |
| | | */ |
| | | public static String getLikeStr2(String str) { |
| | | return StringHelper.isEmpty(str) ? "%" : "%" + str.trim() + "%"; |
| | | public static String getLikeUpperStr(String str) { |
| | | return StringHelper.isEmpty(str) ? null : "%" + str.trim().toUpperCase() + "%"; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 是/否 |
| | | */ |
| | | public static boolean isSqlInjection(String str) { |
| | | if (null == str) { |
| | | return false; |
| | | } |
| | | |
| | | Matcher m = sqlPattern.matcher(str); |
| | | |
| | | return m.matches(); |
| | |
| | | |
| | | /** |
| | | * 获取GUID |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getGuid() { |
| | | return UUID.randomUUID().toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取分钟差数 |
| | | */ |
| | | public static long getMinuteDifference(Timestamp ts) { |
| | | return (ts.getTime() - System.currentTimeMillis()) / 1000 / 60; |
| | | } |
| | | |
| | | /** |
| | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (T t : list) { |
| | | if (null != t) { |
| | | sb.append(t.toString() + join); |
| | | sb.append(t.toString()).append(join); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转整数集合 |
| | | */ |
| | | public static List<Integer> strToIntegers(String str) { |
| | | if (StringHelper.isEmpty(str)) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> list = new ArrayList<>(); |
| | | for (String s : str.split(StaticData.COMMA)) { |
| | | list.add(Integer.parseInt(s)); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | } |