mirror of
				https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
				synced 2025-11-01 02:46:19 +08:00 
			
		
		
		
	add system operator agent
This commit is contained in:
		| @@ -37,6 +37,8 @@ public class SQLCore { | ||||
|  | ||||
| 			sr = new StandardServiceRegistryBuilder().configure().build(); | ||||
| 			sf = new MetadataSources(sr).buildMetadata().buildSessionFactory(); | ||||
|  | ||||
| 			TableOperator.init(); | ||||
| 		} catch (Exception e) { | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
|   | ||||
| @@ -22,5 +22,17 @@ public class TableOperator extends SQLCore { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static Operator get(int id) { | ||||
| 		try (Session s = SQLCore.sf.openSession()) { | ||||
| 			return s.get(Operator.class, id); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	protected static void init() { | ||||
| 		try (Session s = SQLCore.sf.openSession()) { | ||||
| 			Operator.USER_SELF = s.get(Operator.class, -1); | ||||
| 			Operator.ADMIN = s.get(Operator.class, 0); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sola
					Sola