| | |
| | | if (parentId.equals(dParentId)) { |
| | | R dId = idMapper.apply(d); |
| | | List<T> children = toTreeData(data, dId, parentIdMapper, idMapper, consumer); |
| | | if(children.size() > 0) { |
| | | if(!children.isEmpty()) { |
| | | consumer.accept(d, children); |
| | | } |
| | | result.add(d); |
| | |
| | | |
| | | /** |
| | | * 数组倒序 |
| | | * @param bytes |
| | | * @param <T> |
| | | */ |
| | | public static <T> byte[] reverse(byte[] bytes) { |
| | | if (bytes == null) return null; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 大驼峰 转 symbol小驼峰 |
| | | */ |
| | | public static String toSymbolCase(String str, char symbol) { |
| | | if (str == null) { |
| | | return null; |
| | |
| | | return list; |
| | | } |
| | | |
| | | public static String convertToSnakeCaseForOrderByStr(String input) { |
| | | String[] parts = input.split("\\s+"); |
| | | String fieldName = parts[0]; |
| | | String order = parts.length > 1 ? parts[1] : ""; |
| | | |
| | | String snakeCaseField = fieldName.replaceAll("([a-z])([A-Z])", "$1_$2").toLowerCase(); |
| | | |
| | | return snakeCaseField + (order.isEmpty() ? "" : " " + order); |
| | | } |
| | | |
| | | } |