Search in sources :

Example 6 with TestCaseExeStatus

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;
}
Also used : TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus)

Example 7 with TestCaseExeStatus

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;
}
Also used : TestCaseExeStatus(com.ngtesting.platform.entity.TestCaseExeStatus)

Aggregations

TestCaseExeStatus (com.ngtesting.platform.entity.TestCaseExeStatus)7 CaseExeStatusVo (com.ngtesting.platform.vo.CaseExeStatusVo)3 JSONObject (com.alibaba.fastjson.JSONObject)2 AuthPassport (com.ngtesting.platform.util.AuthPassport)2 UserVo (com.ngtesting.platform.vo.UserVo)2 HashMap (java.util.HashMap)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1