use of com.ngtesting.platform.entity.TestCaseStep in project ngtesting-platform by aaronchen2k.
the class CaseStepServiceImpl method changeOrderPers.
@Override
public TestCaseStep changeOrderPers(JSONObject vo, String direction, Long userId) {
TestCaseStep po = (TestCaseStep) get(TestCaseStep.class, vo.getLong("id"));
String hql = "from TestCaseStep st where st.deleted = false and st.disabled = false " + " and testCaseId = ?";
if ("up".equals(direction)) {
hql += " and st.ordr < ? order by ordr desc";
} else if ("down".equals(direction)) {
hql += " and st.ordr > ? order by ordr asc";
}
TestCaseStep neighbor = (TestCaseStep) getDao().findFirstByHQL(hql, vo.getLong("caseId"), vo.getInteger("ordr"));
TestCaseStep step = (TestCaseStep) get(TestCaseStep.class, vo.getLong("id"));
Integer order = step.getOrdr();
step.setOrdr(neighbor.getOrdr());
neighbor.setOrdr(order);
saveOrUpdate(step);
saveOrUpdate(neighbor);
return po;
}
use of com.ngtesting.platform.entity.TestCaseStep in project ngtesting-platform by aaronchen2k.
the class CaseStepServiceImpl method createSampleStep.
@Override
public void createSampleStep(Long caseId) {
TestCaseStep step = new TestCaseStep(caseId, "步骤", "期待结果", 1);
step.setTestCaseId(caseId);
saveOrUpdate(step);
}
use of com.ngtesting.platform.entity.TestCaseStep in project ngtesting-platform by aaronchen2k.
the class CaseStepServiceImpl method delete.
@Override
public boolean delete(Long stepId, Long userId) {
TestCaseStep step = (TestCaseStep) get(TestCaseStep.class, stepId);
step.setDeleted(true);
saveOrUpdate(step);
moveOthersPers(step.getTestCaseId(), step.getOrdr(), "up");
return true;
}
use of com.ngtesting.platform.entity.TestCaseStep in project ngtesting-platform by aaronchen2k.
the class CaseStepAction method up.
@AuthPassport(validate = true)
@RequestMapping(value = "up", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> up(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
TestCaseStep po = caseStepService.changeOrderPers(json, "up", userVo.getId());
TestCaseStepVo stepVo = caseStepService.genVo(po);
ret.put("data", stepVo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.entity.TestCaseStep in project ngtesting-platform by aaronchen2k.
the class CaseStepAction method down.
@AuthPassport(validate = true)
@RequestMapping(value = "down", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> down(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
TestCaseStep po = caseStepService.changeOrderPers(json, "down", userVo.getId());
TestCaseStepVo stepVo = caseStepService.genVo(po);
ret.put("data", stepVo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
Aggregations