mirror of
				https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
				synced 2025-11-01 02:46:19 +08:00 
			
		
		
		
	wechat query command
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package love.sola.netsupport.sql; | ||||
|  | ||||
| import com.google.gson.Gson; | ||||
| import com.google.gson.GsonBuilder; | ||||
| import org.hibernate.SessionFactory; | ||||
| import org.hibernate.boot.MetadataSources; | ||||
| import org.hibernate.boot.registry.StandardServiceRegistryBuilder; | ||||
| @@ -8,6 +9,7 @@ import org.hibernate.service.ServiceRegistry; | ||||
|  | ||||
| import javax.naming.InitialContext; | ||||
| import javax.sql.DataSource; | ||||
| import java.text.DateFormat; | ||||
|  | ||||
| /** | ||||
|  * *********************************************** | ||||
| @@ -18,7 +20,7 @@ import javax.sql.DataSource; | ||||
| public class SQLCore { | ||||
|  | ||||
| 	public static DataSource ds; | ||||
| 	public static Gson gson = new Gson(); | ||||
| 	public static Gson gson = new GsonBuilder().setDateFormat(DateFormat.LONG, DateFormat.LONG).create(); | ||||
| 	public static SessionFactory sf; | ||||
| 	public static ServiceRegistry sr; | ||||
|  | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import love.sola.netsupport.enums.Status; | ||||
| import love.sola.netsupport.pojo.Ticket; | ||||
| import love.sola.netsupport.pojo.User; | ||||
| import org.hibernate.Session; | ||||
| import org.hibernate.criterion.Order; | ||||
| import org.hibernate.criterion.Restrictions; | ||||
|  | ||||
| import java.util.List; | ||||
| @@ -35,6 +36,15 @@ public class TableTicket extends SQLCore { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static Ticket queryLast(User u) { | ||||
| 		try (Session s = SQLCore.sf.openSession()) { | ||||
| 			return (Ticket) s.createCriteria(Ticket.class) | ||||
| 					.addOrder(Order.desc(Ticket.PROPERTY_SUBMIT_TIME)) | ||||
| 					.add(Restrictions.eq(Ticket.PROPERTY_USER, u)) | ||||
| 					.uniqueResult(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	@SuppressWarnings("unchecked") | ||||
| 	public static List<Ticket> queryUnsolvedByBlock(int b) { | ||||
| 		try (Session s = SQLCore.sf.openSession()) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sola
					Sola