list script and testplan by time desc
This commit is contained in:
parent
82f2fe2546
commit
230a2e23ca
|
@ -11,6 +11,7 @@ import org.hibernate.Criteria;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.criterion.Criterion;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -116,7 +117,7 @@ public class ScriptRepositoty extends AbstractRepositoty {
|
|||
Session session = this.getSessionHelper().openSession();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Script> scripts = session.createCriteria(Script.class)
|
||||
.add(Restrictions.eq("user", user))
|
||||
.add(Restrictions.eq("user", user)).addOrder(Order.desc("createDateTime"))
|
||||
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
||||
releaseSession(session);
|
||||
return scripts;
|
||||
|
|
|
@ -121,7 +121,7 @@ public class TestPlanRepository extends AbstractRepositoty {
|
|||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<TestPlan> ret = session.createCriteria(TestPlan.class)
|
||||
.add(Restrictions.eq("user", user))
|
||||
.add(Restrictions.eq("user", user)).addOrder(Order.desc("lastRunningTime"))
|
||||
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue