(String[] args)
| 9 | |
| 10 | public class SqlHump { |
| 11 | public static void main(String[] args) { |
| 12 | String str = "a.id,\n" + |
| 13 | "a.id as order_material_id,\n" + |
| 14 | "k.payment_date as balance_payment_date"; |
| 15 | String[] strings = str.split(","); |
| 16 | List<String> stringList = new ArrayList<>(); |
| 17 | for (String data : strings){ |
| 18 | |
| 19 | if(data.indexOf("a.material_id") >=0){ |
| 20 | // System.out.println(data); |
| 21 | } |
| 22 | if(data.indexOf(" as ")>=0){ |
| 23 | String[] strings1 = data.split("as"); |
| 24 | String j = underlineToHump(strings1[1]); |
| 25 | data = strings1[0] +" as " + j; |
| 26 | |
| 27 | }else { |
| 28 | String j = data.substring(data.indexOf(".")+1); |
| 29 | j = underlineToHump(j); |
| 30 | data = data +" as " + j; |
| 31 | |
| 32 | } |
| 33 | stringList.add(data); |
| 34 | } |
| 35 | |
| 36 | String sql =stringList.stream().collect(Collectors.joining(",")); |
| 37 | System.out.println(sql); |
| 38 | } |
| 39 | |
| 40 | |
| 41 |
nothing calls this directly
no test coverage detected