use of com.ngtesting.platform.entity.TestProjectAccessHistory in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method listRecentProject.
@Override
public List<TestProjectAccessHistory> listRecentProject(Long orgId, Long userId) {
DetachedCriteria dc = DetachedCriteria.forClass(TestProjectAccessHistory.class);
dc.add(Restrictions.eq("orgId", orgId));
dc.add(Restrictions.eq("userId", userId));
dc.add(Restrictions.ne("deleted", true));
dc.add(Restrictions.ne("disabled", true));
dc.createAlias("project", "project");
// dc.add(Restrictions.ne("project.deleted", true));
dc.add(Restrictions.ne("project.deleted", true));
dc.add(Restrictions.ne("project.disabled", true));
dc.addOrder(Order.desc("lastAccessTime"));
List<TestProjectAccessHistory> pos = findPage(dc, 0, 4).getItems();
return pos;
}
use of com.ngtesting.platform.entity.TestProjectAccessHistory in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method genHistoryVos.
@Override
public List<TestProjectAccessHistoryVo> genHistoryVos(List<TestProjectAccessHistory> pos) {
List<TestProjectAccessHistoryVo> voList = new LinkedList<TestProjectAccessHistoryVo>();
for (TestProjectAccessHistory po : pos) {
TestProjectAccessHistoryVo vo = genHistoryVo(po);
voList.add(vo);
}
return voList;
}
use of com.ngtesting.platform.entity.TestProjectAccessHistory in project ngtesting-platform by aaronchen2k.
the class ProjectServiceImpl method getHistoryPers.
@Override
public TestProjectAccessHistory getHistoryPers(Long orgId, Long userId, Long projectId, String projectName) {
DetachedCriteria dc = DetachedCriteria.forClass(TestProjectAccessHistory.class);
dc.add(Restrictions.eq("orgId", orgId));
dc.add(Restrictions.eq("projectId", projectId));
dc.add(Restrictions.eq("userId", userId));
dc.add(Restrictions.eq("deleted", false));
dc.add(Restrictions.eq("disabled", false));
TestProjectAccessHistory history;
List<TestProjectAccessHistory> pos = findAllByCriteria(dc);
if (pos.size() > 0) {
history = pos.get(0);
history.setProjectName(projectName);
} else {
history = new TestProjectAccessHistory(orgId, userId, projectId, projectName);
}
history.setLastAccessTime(new Date());
saveOrUpdate(history);
return history;
}
Aggregations