refact login command

This commit is contained in:
Sola
2015-12-14 21:31:59 +08:00
parent 7c7a9461b3
commit 0cfe01e4d1
2 changed files with 23 additions and 26 deletions

View File

@@ -22,6 +22,15 @@ public class TableOperator extends SQLCore {
}
}
public static Operator get(String wechat) {
try (Session s = SQLCore.sf.openSession()) {
return (Operator) s.createCriteria(Operator.class)
.add(Restrictions.eq(Operator.PROPERTY_WECHAT, wechat))
.uniqueResult();
}
}
public static Operator get(int id) {
try (Session s = SQLCore.sf.openSession()) {
return s.get(Operator.class, id);