| @GetMapping("getJson") |
| public Result getJson(String id) { |
| System.out.println(DateUtil.formatTime(new Date())); |
| HashMap<String, Object> expertInfoQueryMap = new HashMap<>(); |
| FileReader fileReader = new FileReader("G:\\BaiduNetdiskDownload\\医疗软件\\医疗代码\\02-尚医通后端代码\\yygh_parent\\service\\service_cmn\\src\\main\\java\\com\\atguigu\\yygh\\cmn\\controller" + "/testsql.json"); |
| String result = fileReader.readString(); |
| cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(result); |
| Set<String> strings = jsonObject.keySet(); |
| |
| String ziudan = (String) jsonObject.get("ziudan"); |
| String biaoming = (String) jsonObject.get("biaoming"); |
| List<Map<String, Object>> date = (List<Map<String, Object>>) jsonObject.get("date"); |
| Map<String, Object> map = date.get(0); |
| |
| Set<String> keySet = map.keySet(); |
| String ss=""; |
| for (String s : keySet) { |
| ss+="#{map."+s+"},"; |
| } |
| |
| String substring = ss.substring(0, ss.lastIndexOf(",")); |
| String substring1= "("+substring+ ")"; |
| System.out.println(substring1); |
| |
| dictService.getJson(ziudan,biaoming,date,substring1); |
| |
| return Result.ok(expertInfoQueryMap); |
| } |
复制
| <insert id="add3"> |
| insert into ${biaoming}(${ziudan}) values |
| <foreach collection="date" item="map" separator=","> |
| ${substring1} |
| </foreach> |
| </insert> |
复制
json文件结构 得加入糊涂工具类
