use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CaseTypeAction method save.
@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long orgId = userVo.getDefaultOrgId();
CaseTypeVo vo = json.getObject("model", CaseTypeVo.class);
TestCaseType po = caseTypeService.save(vo, orgId);
CaseTypeVo projectVo = caseTypeService.genVo(po);
Map<String, Map<String, String>> casePropertyMap = casePropertyService.getMap(orgId);
ret.put("casePropertyMap", casePropertyMap);
ret.put("data", projectVo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CaseTypeServiceImpl method genVos.
@Override
public List<CaseTypeVo> genVos(List<TestCaseType> pos) {
List<CaseTypeVo> vos = new LinkedList<CaseTypeVo>();
for (TestCaseType po : pos) {
CaseTypeVo vo = genVo(po);
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.entity.TestCaseType in project ngtesting-platform by aaronchen2k.
the class CaseTypeServiceImpl method save.
@Override
public TestCaseType save(CaseTypeVo vo, Long orgId) {
if (vo == null) {
return null;
}
TestCaseType po;
if (vo.getId() != null) {
po = (TestCaseType) get(TestCaseType.class, vo.getId());
} else {
po = new TestCaseType();
}
BeanUtilEx.copyProperties(po, vo);
po.setOrgId(orgId);
if (vo.getId() == null) {
po.setCode(UUID.randomUUID().toString());
String hql = "select max(displayOrder) from TestCaseType tp where tp.orgId=?";
Integer maxOrder = (Integer) getByHQL(hql, orgId);
po.setDisplayOrder(maxOrder + 10);
}
saveOrUpdate(po);
return po;
}
Aggregations