/*** 序列化* @param list* @param filename* @throws IOException*/publicstaticvoidserializeList(List<Map<String,Object>> list,String filename)throwsIOException{try(ObjectOutputStream oos =newObjectOutputStream(newFileOutputStream(filename))){oos.writeObject(list);}}/*** 反序列化* @param filename* @return* @throws IOException* @throws ClassNotFoundException*/publicstaticList<Map<String,Object>>deserializeList(String filename)throwsIOException,ClassNotFoundException{try(ObjectInputStream ois =newObjectInputStream(newFileInputStream(filename))){@SuppressWarnings("unchecked")List<Map<String,Object>> list =(List<Map<String,Object>>) ois.readObject();return list;}}/*** 查询数据** @return*/publicList<Map<String,Object>>getdata(){JdbcTemplate jdbcTemplate2 =getJdbcTemplate2("jdbc:mysql://localhost:3306/gzw?serverTimezone=UTC","root","root");String sql ="select name,max(mon) from (\n"+"select name,lx,sum(money) mon from user GROUP BY name,lx order by name ) t1 GROUP BY name order by name ";List<Map<String,Object>> maps = jdbcTemplate2.queryForList(sql);return maps;}publicListgetLx()throwsIOException,ClassNotFoundException{String name ="gzw.data"+sdf.format(newDate());//先判断有没有文件String dir ="E:\\test\\";File file =newFile(dir + name);//有文件就用文件数据 -数据多久更新if(file.exists()){List<Map<String,Object>> objects =deserializeList(dir + name);return objects;}else{//没有文件数据,查询sqlList<Map<String,Object>> getdata =getdata();//序列化,保存为文件serializeList(getdata, dir + name);return getdata;}}
Swagger2已经在17年停止维护了,取而代之的是 Swagger3(基于openApi3),所以新项目要尽量使用Swagger3.
Open API
OpenApi是业界真正的 api 文档标准,其是由 Swagger 来维护的,并被linux列为api标准&#x…
一、Player Settings 设置 Player Settings>Player>Other Settings> Android > Write Permission > External (SDCard). 二、代码
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Andr…