use of com.ngtesting.platform.entity.TestCaseExeStatus in project ngtesting-platform by aaronchen2k.
the class CaseExeStatusServiceImpl method changeOrderPers.
@Override
public boolean changeOrderPers(Long id, String act) {
TestCaseExeStatus type = (TestCaseExeStatus) get(TestCaseExeStatus.class, id);
String hql = "from TestCaseExeStatus tp where tp.deleted = false and tp.disabled = false ";
if ("up".equals(act)) {
hql += "and tp.displayOrder < ? order by displayOrder desc";
} else if ("down".equals(act)) {
hql += "and tp.displayOrder > ? order by displayOrder asc";
} else {
return false;
}
TestCaseExeStatus neighbor = (TestCaseExeStatus) getDao().findFirstByHQL(hql, type.getDisplayOrder());
Integer order = type.getDisplayOrder();
type.setDisplayOrder(neighbor.getDisplayOrder());
neighbor.setDisplayOrder(order);
saveOrUpdate(type);
saveOrUpdate(neighbor);
return true;
}
use of com.ngtesting.platform.entity.TestCaseExeStatus in project ngtesting-platform by aaronchen2k.
the class CaseExeStatusServiceImpl method save.
@Override
public TestCaseExeStatus save(CaseExeStatusVo vo, Long orgId) {
if (vo == null) {
return null;
}
TestCaseExeStatus po;
if (vo.getId() != null) {
po = (TestCaseExeStatus) get(TestCaseExeStatus.class, vo.getId());
} else {
po = new TestCaseExeStatus();
}
BeanUtilEx.copyProperties(po, vo);
po.setOrgId(orgId);
if (vo.getId() == null) {
po.setCode(UUID.randomUUID().toString());
String hql = "select max(displayOrder) from TestCaseExeStatus";
Integer maxOrder = (Integer) getByHQL(hql);
po.setDisplayOrder(maxOrder + 10);
}
saveOrUpdate(po);
return po;
}
Aggregations