| | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: Mapper map工具类 |
| | | * @description: Mapper map工具类</p> 包含驼峰格式和列名别名 |
| | | * @date 2023/11/11 14:40 |
| | | */ |
| | | @Slf4j |
| | |
| | | Map<String, Object> row = new HashMap<>(); |
| | | int columnCount = rs.getMetaData().getColumnCount(); |
| | | for (int i = 1; i <= columnCount; i++) { |
| | | String columnName = MapUtils.underlineToCamel(rs.getMetaData().getColumnName(i)); |
| | | String columnLabel = rs.getMetaData().getColumnLabel(i); |
| | | String columnName = columnLabel.contains("_") ? MapUtils.underlineToCamel(columnLabel) |
| | | : (Character.isUpperCase(columnLabel.charAt(0)) ? columnLabel.toLowerCase() |
| | | : columnLabel); |
| | | Object columnValue = rs.getObject(i); |
| | | row.put(columnName, columnValue); |
| | | } |