mirror of
				https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
				synced 2025-11-01 02:46:19 +08:00 
			
		
		
		
	let json serialize ISP as number
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package love.sola.netsupport.sql; | ||||
|  | ||||
| import com.google.gson.*; | ||||
| import love.sola.netsupport.enums.ISP; | ||||
| import org.hibernate.SessionFactory; | ||||
| import org.hibernate.boot.MetadataSources; | ||||
| import org.hibernate.boot.registry.StandardServiceRegistryBuilder; | ||||
| @@ -22,6 +23,8 @@ public class SQLCore { | ||||
| 	public static Gson gson = new GsonBuilder() | ||||
| 			.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong())) | ||||
| 			.registerTypeAdapter(Date.class, (JsonSerializer<Date>) (src, typeOfSrc, context) -> new JsonPrimitive(src.getTime())) | ||||
| 			.registerTypeAdapter(ISP.class, (JsonDeserializer<ISP>) (json, typeOfT, context) -> ISP.fromId(json.getAsJsonPrimitive().getAsInt())) | ||||
| 			.registerTypeAdapter(ISP.class, (JsonSerializer<ISP>) (src, typeOfSrc, context) -> new JsonPrimitive(src.id)) | ||||
| 			.create(); | ||||
| 	public static SessionFactory sf; | ||||
| 	public static ServiceRegistry sr; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sola
					Sola