Search in sources :

Example 6 with TestVer

use of com.ngtesting.platform.entity.TestVer in project ngtesting-platform by aaronchen2k.

the class VerAction method delete.

@AuthPassport(validate = true)
@RequestMapping(value = "delete", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> delete(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 id = json.getLong("id");
    TestVer po = verService.delete(id, userVo.getId());
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestVer(com.ngtesting.platform.entity.TestVer) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with TestVer

use of com.ngtesting.platform.entity.TestVer in project ngtesting-platform by aaronchen2k.

the class VerAction method list.

@AuthPassport(validate = true)
@RequestMapping(value = "query", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> list(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 projectId = json.getLong("projectId");
    List<TestVer> ls = verService.list(projectId);
    List<TestVerVo> vos = verService.genVos(ls);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestVer(com.ngtesting.platform.entity.TestVer) TestVerVo(com.ngtesting.platform.vo.TestVerVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with TestVer

use of com.ngtesting.platform.entity.TestVer in project ngtesting-platform by aaronchen2k.

the class VerServiceImpl method list.

@Override
public List<TestVer> list(Long projectId) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestVer.class);
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.addOrder(Order.asc("createTime"));
    List<TestVer> ls = findAllByCriteria(dc);
    return ls;
}
Also used : DetachedCriteria(org.hibernate.criterion.DetachedCriteria) TestVer(com.ngtesting.platform.entity.TestVer)

Aggregations

TestVer (com.ngtesting.platform.entity.TestVer)8 TestVerVo (com.ngtesting.platform.vo.TestVerVo)5 JSONObject (com.alibaba.fastjson.JSONObject)3 AuthPassport (com.ngtesting.platform.util.AuthPassport)3 UserVo (com.ngtesting.platform.vo.UserVo)3 HashMap (java.util.HashMap)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 Constant (com.ngtesting.platform.config.Constant)1 LinkedList (java.util.LinkedList)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1